The doc says "Closes the file or pipe associated with the file handle, returning true only if IO buffers are successfully flushed and closes the system file descriptor. Closes the currently selected filehandle if the argument is omitted."
So, I don't think that will work for input files.
Comment on Re^2: Best way to handle readline errors?