Detect disconnection event