I HAVE had this happen in VS2008 when running a program, stopping the execution once I've opened a file, and then running again and trying to do anything with the file. When that happens, the only way I've found to fix it is to close VS and re-open it, or kill the *.vshost.exe process, in order to release the file. I've never really looked into why it happens, but I assume it's because the actual process that runs as your app from VS is the *.vshost.exe file, which doesn't close when you end the execution of your program.
Also, to prevent this from happening, always either be sure to properly close your filestreams, or utilize a using
block. Make sure that this part of your code executes before ending execution via VS.
If this ISN'T what's happening, check the answer provided by mkus for how to see if another application has your file locked.