Fix issues with first write to nonexistent file.