Only initiate the WebSocket closing handshake on the client

#3342