What are the errors you are getting?

At first glance I would say that you need to close the file before trying to delete it, otherwise it is marked "in use".
_________________________
Today is the tomorrow you worried about yesterday.