code: async def close_async(self):
          
          if self.message_handler:
              await self.message_handler.destroy_async()
              self.message_handler = None
          self._shutdown = True
          if self._keep_alive_thread:
              await self._keep_alive_thread
              self._keep_alive_thread = None
          if not self._session:
              return  # already closed.
          if not self._connection.cbs:
              _logger.info("Closing non-CBS session.")
              await asyncio.shield(self._session.destroy_async())
          else:
              _logger.info("CBS session pending %r.", self._connection.container_id)
          self._session = None
          if not self._ext_connection:
              _logger.info("Closing exclusive connection %r.", self._connection.container_id)
              await asyncio.shield(self._connection.destroy_async())
          else:
              _logger.info("Shared connection remaining open.")
          self._connection = None
docs: Close the client asynchronously. This includes closing the Session
          and CBS authentication layer as well as the Connection.
          If the client was opened using an external Connection,
          this will be left intact.