code: def close(self) -> None:
          
          def _shutdown() -> None:
              self.transport.close()
              self.shutdown_event.set()
  
          with self._shutdown_lock:
              if not self._shutdown:
                  self._shutdown = True
                  self.protocol.loop.call_soon_threadsafe(_shutdown)
docs: Closes the transport and the background event loop as soon as possible.