BUG Clean up the logOut and session destructon routines.
Merge pull request #1994 from mateusz/logout-cleanup

BUG Clean up the logOut and session destructon routines.