Improve runtime configuration cleanup for tests.