Some more earlier failures with the same issue (all in Windows builds):
https://gradle-enterprise.elastic.co/s/ic3vf76vlpiho
https://gradle-enterprise.elastic.co/s/7nsuvadgg5bbm
https://gradle-enterprise.elastic.co/s/7kcrezoswrgdg

**Build scan:**
https://gradle-enterprise.elastic.co/s/whgmtqrtovpgu/tests/:server:internalClusterTest/org.elasticsearch.reservedstate.service.FileSettingsServiceIT/testErrorSaved

**Reproduction line:**
`gradlew ':server:internalClusterTest' --tests "org.elasticsearch.reservedstate.service.FileSettingsServiceIT.testErrorSaved" -Dtests.seed=762F971779043BEB -Dtests.locale=es-BO -Dtests.timezone=Africa/Luanda -Druntime.java=18`

**Applicable branches:**
main

**Reproduces locally?:**
Didn't try

**Failure history:**
https://gradle-enterprise.elastic.co/scans/tests?tests.container=org.elasticsearch.reservedstate.service.FileSettingsServiceIT&tests.test=testErrorSaved

**Failure excerpt:**
```
org.elasticsearch.cluster.metadata.ProcessClusterEventTimeoutException: failed to process cluster event (delete_repository [*]) within 30s

  at __randomizedtesting.SeedInfo.seed([762F971779043BEB:C5DE1806AEE40E21]:0)
  at org.elasticsearch.cluster.service.MasterService$Batcher.lambda$onTimeout$1(MasterService.java:165)
  at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingRunnable.run(ThreadContext.java:825)
  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
  at java.lang.Thread.run(Thread.java:833)

```
server/src/main/java/org/elasticsearch/reservedstate/service/FileSettingsService.java
cleanupWatchKeys();
            } catch (IOException e) {
                logger.warn("encountered exception while closing watch service", e);
            } catch (InterruptedException interruptedException) {
                logger.info("interrupted while closing the watch service", interruptedException);
            } finally {
                watchService = null;
                logger.info("watcher service stopped");
            }
        } else {
            logger.debug("file settings service already stopped");
        }
    }
    private WatchKey enableSettingsWatcher(WatchKey previousKey, Path settingsDir) throws IOException {
        if (previousKey != null) {
            previousKey.cancel();
        }
        return settingsDir.register(
            watchService,
            StandardWatchEventKinds.ENTRY_MODIFY,
            StandardWatchEventKinds.ENTRY_CREATE,
            StandardWatchEventKinds.ENTRY_DELETE
        );
    }
    CountDownLatch processFileSettings(Path path, Consumer<Exception> errorHandler) throws IOException {
        CountDownLatch waitForCompletion = new CountDownLatch(1);
        logger.info("processing path [{}] for [{}]", path, NAMESPACE);
        try (
            var fis = Files.newInputStream(path);
            var bis = new BufferedInputStream(fis);