Found one small error. Typo, $ADIntalled should be $ADInstalled. Not the source of you problem however. Double check all the file handles for starters.

I'm guessing that it is an intermittent problem and not repeatable. Could be a case of file contention. may want to put your Open() in a countdown loop to retry.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.