Refbake behaving strangely in Rhino macro

I have a strange intermittent problem. I run grasshopper scripts using grasshopper player in a Rhino macro. Running the same macro over and over again should always produce the same result… but it doesn’t. Below is a simplified image of what I am doing. I reference and bake the same components (CW base surfaces), each time processing the objects and modifying attributes. There are 28 CW base surfaces. Each time I reference 28 objects and bake 28 objects, but the third grasshopper definition sometimes references 84 objects (3 of each surface). I have determined this using context print. I can’t reproduce the error by opening the file in grasshopper. It only happens with the player. It also does not seem to happen if I stop after GH02 and wait a bit before running GH03.

My macro is:
-_GrasshopperPlayer GH01.gh
True _Enter
-_GrasshopperPlayer GH02.gh
True _Enter
-_GrasshopperPlayer GH03.gh
True _Enter

If anyone has a clue as to what could cause this behaviour, please let me know, thanks.