Handle the logout process