fix GH-207

Do not block emitting `close` event prior to `open`. Additionally, removed apparently unnecessary call to `onclose()` since this will be called by the browser (standard websocket API) in any case, when required.