Cleanup error handling (again as I moved the fclose() to do_log())