Check whether socket is still open

When sending a lot of messages asynchronously. There were no clause ```disconnected({cast, Frame}, Context)``` and process died.