added close and error event listeners to websocket module