Websocket: Only send when the socket is open.

Sending used to be allowed in state CLOSING, which could result in an
assertion failure during finalize.

Fixes #102.