Method OnSocketIsClosed

Handles the event when the socket is closed.