code: def _close_websocket(self):
          
          close_method = getattr(self._websocket, "close", None)
          if callable(close_method):
              asyncio.ensure_future(close_method(), loop=self._event_loop)
          self._websocket = None
          self._dispatch_event(event="close")
docs: Closes the websocket connection.