simplified session-ending logic