detect when the connection is severed