code: async def close(self):
          
  
          # Remove the core NATS Streaming subscriptions.
          await self._close()
  
          req = protocol.CloseRequest()
          req.clientID = self._client_id
          msg = await self._nc.request(
              self._close_req_subject,
              req.SerializeToString(),
              self._connect_timeout,
              )
          resp = protocol.CloseResponse()
          resp.ParseFromString(msg.data)
  
          if resp.error != "":
              raise StanError(resp.error)
docs: Close terminates a session with NATS Streaming.