make sure that when we exit the application we try and persist everything