Add thorough error checking and reporting. Any errors?
Does it ever open successfully after a delay? Do reads and writes work as expected?

Use the debugger to "break" during a delay and find...