Do not write if the websocket is not open.

This PR solves the issues at: https://github.com/mcollina/mosca/issues/69.

Writing to a closed websocket-stream throws an exception, but we expect it to be sent to the `'error'` event handler.