Failing the test after 10 iterations without a loading error is problematic because it may take 11 iterations to get a loading error.
Fix that by running until a loading error occurs, which should happen in almost all runs within the first 10 iterations.
This is a backport of [[https://github.com/bitcoin/bitcoin/pull/20569 | core#20569]]