Fix metrics not shutting down if there are open connections (#6220)
Fix prometheus metrics not shutting down if there are open connections. I fixed the same issue in the past but it broke again after a dependecy upgrade. See also: https://github.com/paritytech/polkadot-sdk/pull/1637