Don't write to log if output file has been closed