This diff makes sure we don't respond to 'open' and 'close' events that come after a 'close' event. It mirrors code in lib/socket/socket.react.js.
We need this additional state so that in the on('open' block, we can differentiate the state prior to initialization to the state after closure.