After updating to version EnergyPlus 9.4.0 IO Freeze, I notice the runtime API has changed introducing a new StateManager. Using this version and adapting the code, the issue disappears.
Hope this helps