part of the program to save history files written