Fixes the fact that repository metadata with the same settings still results in multiple settings instances being cached as well as leaking settings on closing a repository. Closes #56702