Thanks all for the reassuring responses although I'm intrigued by the limitations on using non-global handles with the write function.
Since this type of code will go into a modperl environment (so the 'program' will never really terminate) it is important to be 100% sure the system will indeed close a file and free the associated resources.