Fix Optimizer destructor (onexit crash)