Handle socket closed message gracefully