func (r *Registry) Close() error {
	if r.closing == nil {
		return nil
	}
	close(r.closing)
	return <-r.closed
}
func (r *Registry) Close() error {
	if r.closing == nil {
		return nil
	}
	close(r.closing)
	return <-r.closed
}
// Close flushes all pending data to reporters
// and releases resources.