Enables option to only store changes on close

This patch adds a setting, "history_on_close", that when set to "true"
will only run the history check when a view is closed. This reduces the
stored changes to major ones.