When the listening loop detects socket closure, the socket is explicitly closed. The local endpoint is notified when the socket is closed unexpectedly.