Add teardown function which cleans up old apps.