Do you have any thoughts on the fix? Approaches to try for me seem to include: * Lock, reopen rw, unlock if we get EBADF * Clear the openclose flag and try again if we get EBADF * Lock around the entire sequential operation in retrieve One factor to consider is difference between Windows and Unix locking semantics.