Plotting layers fail in 2nd run when using constraints
With constraints, if one runs an optimisation after another has finished/was stopped, the constraints plot breaks the code tries to create a layer with a name that already exists (see here). These layers already exist because they were created for the first optimisation. The GUI tries to create them again because, at the start of the second optimisation, this condition fails, as the layers are empty, and thus you run the else branch where the layers are created. The solution is either to destroy the layers when the old curves are cleared, or to check the layer name doesn't already exist.
Reported by Francisco Huhn.