### CI Link

https://gradle-enterprise.elastic.co/s/2wbpgc72g2qsm/tests/:server:internalClusterTest/org.elasticsearch.snapshots.SnapshotStressTestsIT/testRandomActivities?top-execution=1

### Repro line

./gradlew ':server:internalClusterTest' --tests "org.elasticsearch.snapshots.SnapshotStressTestsIT.testRandomActivities" -Dtests.seed=7FD24A23B626E47 -Dtests.locale=sq-AL -Dtests.timezone=Asia/Khandyga -Druntime.java=20

### Does it reproduce?

No

### Applicable branches

8.8

### Failure history

https://gradle-enterprise.elastic.co/scans/tests?search.startTimeMax=1689083199013&search.startTimeMin=1688418000000&search.timeZoneId=Europe/Bucharest&tests.container=org.elasticsearch.snapshots.SnapshotStressTestsIT&tests.test=testRandomActivities

### Failure excerpt

```
java.lang.AssertionError: java.lang.AssertionError: java.lang.NullPointerException: Cannot invoke "org.elasticsearch.cluster.SnapshotsInProgress$Entry.failure()" because "entry" is null
	at __randomizedtesting.SeedInfo.seed([7FD24A23B626E47]:0)
	at org.elasticsearch.snapshots.SnapshotsService.finalizeSnapshotEntry(SnapshotsService.java:1460)
	at org.elasticsearch.snapshots.SnapshotsService.runNextQueuedOperation(SnapshotsService.java:1548)
	at org.elasticsearch.snapshots.SnapshotsService.lambda$finalizeSnapshotEntry$28(SnapshotsService.java:1441)
	at org.elasticsearch.action.ActionListener$2.onResponse(ActionListener.java:158)
	at org.elasticsearch.repositories.FinalizeSnapshotContext.onResponse(FinalizeSnapshotContext.java:117)
	at org.elasticsearch.repositories.blobstore.BlobStoreRepository.lambda$finalizeSnapshot$41(BlobStoreRepository.java:1390)
	at org.elasticsearch.action.ActionListener$2.onResponse(ActionListener.java:158)
	at org.elasticsearch.action.ActionRunnable$2.accept(ActionRunnable.java:50)
	at org.elasticsearch.action.ActionRunnable$2.accept(ActionRunnable.java:47)
	at org.elasticsearch.action.ActionRunnable$3.doRun(ActionRunnable.java:72)
	at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:983)
	at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:26)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
	at java.base/java.lang.Thread.run(Thread.java:1623)
Caused by: java.lang.AssertionError: java.lang.NullPointerException: Cannot invoke "org.elasticsearch.cluster.SnapshotsInProgress$Entry.failure()" because "entry" is null
	... 15 more
Caused by: java.lang.NullPointerException: Cannot invoke "org.elasticsearch.cluster.SnapshotsInProgress$Entry.failure()" because "entry" is null
	at org.elasticsearch.snapshots.SnapshotsService.finalizeSnapshotEntry(SnapshotsService.java:1324)
	... 14 more
```
server/src/main/java/org/elasticsearch/repositories/blobstore/BlobStoreRepository.java
import java.util.stream.LongStream;
import java.util.stream.Stream;
import static org.elasticsearch.core.Strings.mat;
import static org.elasticsearch.index.snapshots.blobstore.BlobStoreIndexShardSnapshot.FileInfo;
import static org.elasticsearch.index.snapshots.blobstore.BlobStoreIndexShardSnapshot.FileInfo.canonicalName;
import static org.elasticsearch.indices.recovery.RecoverySettings.INDICES_RECOVERY_MAX_BYTES_PER_SEC_SETTING;
/**
 * BlobStore - based implementation of Snapshot Repository
 * <p>
 * This repository works with any {@link BlobStore} implementation. The blobStore could be (and preferred) lazy initialized in
 * {@link #createBlobStore()}.
 * </p>
 * For in depth documentation on how exactly implementations of this class interact with the snapshot functionality please refer to the
 * documentation of the package {@link org.elasticsearch.repositories.blobstore}.
 */
public abstract class BlobStoreRepository extends AbstractLifecycleComponent implements Repository {
    private static final Logger logger = LogManager.getLogger(BlobStoreRepository.class);
    protected volatile RepositoryMetadata metadata;
    protected final ThreadPool threadPool;
    public static final String SNAPSHOT_PREFIX = "snap-";
    public static final String INDEX_FILE_PREFIX = "index-";
    public static final String INDEX_LATEST_BLOB = "index.latest";
    private static final String TESTS_FILE = "tests-";
    public static final String METADATA_PREFIX = "meta-";
    public static final String METADATA_NAME_FORMAT = METADATA_PREFIX + "%s.dat";
    public static final String SNAPSHOT_NAME_FORMAT = SNAPSHOT_PREFIX + "%s.dat";
    private static final String SNAPSHOT_INDEX_PREFIX = "index-";
    private static final String SNAPSHOT_INDEX_NAME_FORMAT = SNAPSHOT_INDEX_PREFIX + "%s";
    public static final String UPLOADED_DATA_BLOB_PREFIX = "__";