in reply to Re^4: data leak using package
in thread data leak using package

using indirect File Handles would have presumably saved me from that

Indirect filehandles get automatically closed (and therefore flushed) when the variable holding them goes out of scope. So it may have solved your problem, but only if the filehandle variable went out of scope before you renamed the file. This technique doesn't automatically solve your problems.