I assume the thread is running in this loop, and pFile is sent to this thread, leaving it for this thread to close the file.
not the best way to code, and if possible, look at the pFile packaging in a smart / shared pointer that fclose will call when the reference count drops to zero (find this design pattern if you are not familiar with it).
just enter, you have to make sure that anyone even gets a pointer to pFile fclose calls on it (do not call fclose on it from the main thread if another thread should work on it).
hope this helps.
btw, '' in FILE, tells me that this is C ++ code (java does not have '*' types near it).
Eyal lev
source share