Correct behavior when writing unopened file