now all progress will be written to the file even after programs throws exception