### 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/internalClusterTest/java/org/elasticsearch/snapshots/SharedClusterSnapshotRestoreIT.java
logger.info("--> checking that _current returns the currently running snapshot");
        GetSnapshotsResponse getResponse = client.admin()
            .cluster()
            .prepareGetSnapshots("test-repo")
            .setCurrentSnapshot()
            .execute()
            .actionGet();
        assertThat(getResponse.getSnapshots().size(), equalTo(1));
        SnapshotInfo snapshotInfo = getResponse.getSnapshots().get(0);
        assertThat(snapshotInfo.state(), equalTo(SnapshotState.IN_PROGRESS));
        snapshotStatus = client.admin().cluster().prepareSnapshotStatus().get().getSnapshots().get(0);
        assertThat(snapshotInfo.totalShards(), equalTo(snapshotStatus.getIndices().get("test-idx").getShardsStats().getTotalShards()));
        assertThat(snapshotInfo.successfulShards(), equalTo(snapshotStatus.getIndices().get("test-idx").getShardsStats().getDoneShards()));
        assertThat(snapshotInfo.shardFailures().size(), equalTo(0));
        logger.info("--> unblocking blocked node");
        unblockNode("test-repo", blockedNode);
        awaitNoMoreRunningOperations();
        snapshotInfo = getSnapshot("test-repo", "test-snap");
        logger.info("Number of failed shards [{}]", snapshotInfo.shardFailures().size());
        logger.info("--> checking snapshot status again after snapshot is done");
        response = client.admin().cluster().prepareSnapshotStatus("test-repo").addSnapshots("test-snap").execute().actionGet();
        snapshotStatus = response.getSnapshots().get(0);
        assertThat(snapshotStatus.getIndices().size(), equalTo(1));
        assertThat(snapshotStatus.includeGlobalState(), equalTo(false));
        SnapshotIndexStatus indexStatus = snapshotStatus.getIndices().get("test-idx");
        assertThat(indexStatus, notNullValue());
        assertThat(indexStatus.getShardsStats().getInitializingShards(), equalTo(0));
        assertThat(indexStatus.getShardsStats().getFailedShards(), equalTo(snapshotInfo.failedShards()));
        assertThat(indexStatus.getShardsStats().getDoneShards(), equalTo(snapshotInfo.successfulShards()));
        assertThat(indexStatus.getShards().size(), equalTo(snapshotInfo.totalShards()));