Close the server and terminate connections with close code 1001.

        This method is idempotent.

def close(self) -> None:
        """
        Close the server and terminate connections with close code 1001.

        This method is idempotent.

        """
        if self.close_task is None:
            self.close_task = self.loop.create_task(self._close())