SyntaxFix
Write A Post
Hire A Developer
Questions
The code works as best I can tell. I would fire up Sysinternals process explorer and find out what is holding the file open. It might very well be Visual Studio.