handle agent disconnection