Small cleanup on runtime shutdown to move more code to the same spot and reduce duplication.