This, together with the knowledge that "table:function(args)" syntax is syntatic sugar for "table.function(table, args)" explains the behaviour you are experiencing. Been there as well.
If f is variable holding the IO library's file object, then, to close the file, one needs to say f:close().Note the reference manual documents only this use, with the colon syntax.One, however, could also write f.close(). It is a pretty simple error to make, as I just learned from a colleague. What is the effect of that?The reference manual does not say.Looking at the implementation, what seems to happen is that the standard output handle gets closed instead! I'd say this is a bug.I think f.close() should result in an error just like it does with f.read() and the other file functions.Cheers,V.