Ensure that the disconnect call does not throw

even if no WebSocket object has been created.