fix issue/168

When trying to set up a connection, the readyState is 'opening'. And onClose CAN be called when the readyState was either 'opening' (trying to connect) or 'open' (when connected).

It should not be able to close on 'opening' because that means no connection is established