What the FOPEN function returns?
Can You delete the file with other programm like explorer?
Not to be able to close the file opened with FOPEN and FOPEN returns a valid file handler!
That was never happening to me. Did you have rights to delete the files on that computer?
I think the error message is on the ERASE line.
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.