update relay shutdown to use newer stats api.
stats flush takes a lock itself so avoid that case