fixed crash at exit

Fixed crash at destruction of Simulation objects. Not needed for the main branch.