in reply to Help: STDOUT flaking out?

STDOUT is a predefined filehandle. When you open a new file with that handle, the old is closed.
After that you close STDOUT explicitly, so nothing is printed.

Don't use STDOUT to open a file, use a different name.