Fixed cleanup and shutdown ordering for dump.