Verify the socket before closing