def atexit_operations(self):
<EOL>self.history_manager.end_session()<EOL>for tfile in self.tempfiles:<EOL><INDENT>try:<EOL><INDENT>os.unlink(tfile)<EOL><DEDENT>except OSError:<EOL><INDENT>pass<EOL><DEDENT><DEDENT>self.reset(new_session=False)<EOL>self.hooks.shutdown_hook()<EOL>
This will be executed at the time of exit.

        Cleanup operations and saving of persistent data that is done
        unconditionally by IPython should be performed here.

        For things that may depend on startup flags or platform specifics (such
        as having readline or not), register a separate atexit function in the
        code that has the appropriate information, rather than trying to
        clutter