code: def close(self) -> None:
          
          if self.transport is not None and not self.transport.is_closing():
              self.transport.close()
  
          if self._connect_lock.locked():
              self._connect_lock.release()
  
          self.protocol = None
          self.transport = None
docs: Closes the connection.