in reply to read closed directory handle?

You're closing the FILEHANDLE with close. I don't think a warning is generated when trying to close a directory handle.
If you use closedir, you'll wind up with nothing printed.

Update: It doesn't hurt to check if you successfully close file or directory handles. That would show the error with the close, instead of closedir.
My guess on why warnings and strict didn't show anything is that you used the variables involved, but that's only a guess.
readline will bring up a warning on a closed filehandle, but readdir doesn't seem to care that's it tries reading a closed directory handle.