code: def close(self):
          
          self._sock = None
          self._controller = None
          if hasattr(self, "_port") and self._port:
              portpicker.return_port(self._port)
              self._port = None
docs: Shut down the socket connection, client and controller