Session invalidate should be called only when session is still valid.