It may not be exactly related to your requirement.
I'm trying to convey that when you see that file is not updated, there may be a case that the file handle not selected for automatic flushing. In such a case, you can use the select to make the file updation proper.
This is just to give you some clarification in the "files not altered" matter.