automatically clear history when app is closed