Ensure that `opentracing` scopes are activated and closed at the right time.