Include writing to file in revertTaskHistories function.