Fix writing the incremental log file in py3