Remove race condition when opening/closing substates in same update