If I close a dataset and immediately open it again, it starts a whole cycle of errors and the application has to be killed.
This happens anywhere I place the 2 commands one after another. If I insert a Sleep(5) command between the close and open there is no problem.