Try commenting out all the code between OpenFile and CloseFile to see if it's this which is causing the hang. If so, you could add the file to an area rather than using OpenFile, to see if that helps.
Hi, Paul.
Sounds like you're talking about REST API. And that your are overwriting data with older values if B managed to read record before A finished to update it. Classic conflict resolution ...