Fixed object destruction on shutdown

Now correctly takes care of exceptions and actually really clears all
objects