I have had DISSIMILAR problems and my solution was to use a FLUSH command.
This may NOT help your problem but perhaps it is worth a try. The bad part is that you should put it INSIDE the loop of updates, thus slowing down the exectuion of each/every iteration of the loop.