We tried a hack to force flush to disk as early as possible but this broke everything so we stopped. We do try to untie as early as possible. Should I paste in the test scripts? They are a mess, admittedly, as they were thrown together from bits and pieces to prove a point.
It really looks like locking really fails for us in the scripts.