if you want to daysychain a filehandle through some functions and each function is allowed to close th file you might look in a following function first, if the handle is still valid.
Opening a file, there often will be used a code like
if (!$fh = fopen($filename, $mode)) return false;
But if you possably have closed the file and you want to check that, a smililar statement would not work.
DOES NOT WORK: if (!$fh) end_of_chain();
use beter: if (is_resource($fh)) end_of_chain();