Check whether socket is still open

This is a case with very rare occurrence - massive message queue (more than system can consume) and remote socket closes. ```Transport:send/2``` returns ```{error, closed}``` but we're still in ```connected``` state.

What I'm trying to achieve with these changes is to have working FSM even when socket dies - that's way both ```onconnect/2``` and ```ondisconnect/2``` are needed - to maintain connection status from handler and option to reconnect later.