Redesign closing session logic.