Potential race condition in to_file.c.