checkpoint progress by writing to file