Closing I/O files between writes

[CR #330676] The operating system automatically moves any open file descriptors along with a file. In addition, permissions are checked only when a file is first opened. This means that permission changes to the file take effect only when the file is written.

Workaround: None.