If the advanced Dome setting "Inhibit slaving when imaging" is on, and there is a script error during imaging, the slaving is left OFF.
Save slaving state when the script starts, then restore it at script end, whether it's an error or not.