save history on exit bug

1/2 of history issue