Handle logout event