Add support for the websocket close status code and reason fields.

Closes #890.