Close/Write the session data before exiting