Merge "Fix potential deadlock in shutdown in HistoricalRegistry"