Clean up history file