in reply to checking a file handle to see if it is open

You can test if the handle is writable with -w HANDLE. That will return false if the handle has been closed.

I suspect, though, that the errors are coming from the mail application instead of a double close. Here's what happens with a double close:

$ perl -w -e'open MAIL, ">", "/dev/null"; close MAIL or warn 1, $!; cl +ose MAIL or warn 2, $!' 2Bad file descriptor at -e line 1. $
The second close would not pick up mail system errors, since the mail system is already dissociated from the dead handle.

I think your problem is with the mail app, and you don't give much to go on for that. Lots of scripts people sell are not particularly well-written. Does yours use one of the standard CPAN Mail modules?

After Compline,
Zaxo