### Elasticsearch Version

8.5.0

### Installed Plugins

_No response_

### Java Version

_bundled_

### OS Version

Linux 9b4c50a443c1 5.15.0-52-generic #58-Ubuntu SMP Thu Oct 13 08:03:55 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

### Problem Description

In 8.5, _nodes/stats returns a failure message if the node has closed indices. In previous versions, it works.
Please see steps to reproduce.

### Steps to Reproduce

```
$ curl -XPUT http://localhost:9200/test_index
$ curl http://localhost:9200/_nodes/stats  # <- it works
$ curl -XPOST http://localhost:9200/test_index/_close
$ curl http://localhost:9200/_nodes/stats
{
  "_nodes": {
    "total": 1,
    "successful": 0,
    "failed": 1,
    "failures": [
      {
        "type": "failed_node_exception",
        "reason": "Failed node [...]",
        "node_id": "...",
        "caused_by": {
          "type": "null_pointer_exception",
          "reason": "Cannot invoke \"org.elasticsearch.index.mapper.MapperService.mappingLookup()\" because the return value of \"org.elasticsearch.index.IndexService.mapperService()\" is null"
        }
      }
    ]
  },
  "cluster_name": "...",
  "nodes": {}
}
```

### Logs (if relevant)

_No response_
server/src/main/java/org/elasticsearch/index/IndexService.java
import org.elasticsearch.indices.cluster.IndicesClusterStateService;
import org.elasticsearch.indices.fielddata.cache.IndicesFieldDataCache;
import org.elasticsearch.indices.recovery.RecoveryState;
import org.elasticsearch.plugins.IndexStorePlugin;
import org.elasticsearch.script.ScriptService;
import org.elasticsearch.search.aggregations.support.ValuesSourceRegistry;
import org.elasticsearch.threadpool.ThreadPool;
import org.elasticsearch.xcontent.XContentParserConfiguration;
import java.io.Closeable;
import java.io.IOException;
import java.nio.file.Path;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.BooleanSupplier;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.LongSupplier;
import java.util.function.LongUnaryOperator;
import java.util.function.Supplier;
import static java.util.Collections.emptyMap;
import static org.elasticsearch.core.Strings.format;
public class IndexService extends AbstractIndexComponent implements IndicesClusterStateService.AllocatedIndex<IndexShard> {