Handle socket connection closing