Avoid "Operating on closed TCP connection" when closing a WebSocket connection. See #224.