I've had similar issues with AV's.
You need to to put it into a try catch, and in the catch, add a Sleep() and then try again.
I ended up having to work out how big the file is to determine how long the sleep should be (based upon how long the scan was going on was somewhat proportional to the time it took to scan).
Hope this is enough to get you going?