Use the IDL_FileSetClose() function to prevent files from closing. It does this by setting or clearing the IDL_F_NOCLOSE bit in the flags field of the internal file descriptor maintained by IDL for the file (see File Information). This feature is used primarily in graphics drivers for printers. For example, the PostScript driver uses this feature to prevent the user from closing the plot data file prematurely.
When IDL exits, it only closes open files that do not have the IDL_F_NOCLOSE bit set. Files with close inhibited are left alone. Often, you will want to declare an exit handler which takes care of closing such files.
void IDL_FileSetClose(int unit, int allow)
The Logical Unit Number (LUN) of the file in question. The file must be open for this function to have effect.
Set this field to TRUE if users are allowed to close the file. Set to FALSE if users should be prevented from closing the file.