Salem,
I worked over the function and found that as long as the pointer "fptr" wasn't NULL I could close it without any errors.
I use "fclose" in both segments of the switch statement. That is, if fptr is not null it is closed. If the switch statement is by-passed then the pointer "fptr" is NULL and therefore doesn't need to be closed.
Thank you for not giving up on me.

Paul