in reply to upload filehandle expiration
The filehandles are closed either at the end of the script, or when you open them again. Or when you leave the scope where the filehandles were defined, which seems to be your case.