Running the optimizer piggybacks most of the code that gets run when taking data normally, but the optimizer seems to do a few things before and after each iteration which can have some undesired side-effects. See #23 and 3e9d706 for reference on how it wasn't working properly in the past, as well as the more recent quick fix in 8b29c21 to prevent preExperiment from crashing certain modules when it gets run repeatedly at the end of an experiment.
As of right now it seems to work fine, but the code could use some cleanup to prevent potential problems in the future.