My application reads a txt file using OPEN / CLOSE. Even after the application is ended, the file is in a state that will not allow the Delete function of Windows Explorer to work. What is returned is this message

"Error Deleting File Cannot delete tempea: Access is denied
Make sure the disk is not full or write-protected
and that the file is not currently in use."

If I reboot my PC, then I can delete the file with Windows Explorer.

What can I do within my VB program to make this file available for normal
use??


***********
***********
I found a chunk of code to test whether a file was open or closed. Put it in at the end of my application and when found the file open, I used the CLOSE #5 to close the file in question. I had called the code chunk a second time to see if the file was open or closed. IT IS STILL OPEN!!

That is why I get the problem stated above.

How can I close the file? Or figure out why it is still OPEN??