### 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.apache.lucene.index.DirectoryReader;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.search.IndexSearcher;
import org.apache.lucene.search.Sort;
import org.apache.lucene.store.AlreadyClosedException;
import org.apache.lucene.store.Directory;
import org.apache.lucene.util.Accountable;
import org.elasticsearch.Assertions;
import org.elasticsearch.client.internal.Client;
import org.elasticsearch.cluster.metadata.IndexMetadata;
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
import org.elasticsearch.cluster.node.DiscoveryNode;
import org.elasticsearch.cluster.routing.ShardRouting;
import org.elasticsearch.cluster.service.ClusterService;
import org.elasticsearch.common.io.stream.NamedWriteableRegistry;
import org.elasticsearch.common.settings.Setting;
import org.elasticsearch.common.settings.Setting.Property;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.util.BigArrays;
import org.elasticsearch.common.util.Maps;
import org.elasticsearch.common.util.concurrent.AbstractAsyncTask;
import org.elasticsearch.common.util.concurrent.AbstractRunnable;
import org.elasticsearch.core.CheckedFunction;
import org.elasticsearch.core.IOUtils;
import org.elasticsearch.core.Nullable;
import org.elasticsearch.core.TimeValue;
import org.elasticsearch.env.NodeEnvironment;
import org.elasticsearch.env.ShardLock;
import org.elasticsearch.env.ShardLockObtainFailedException;
import org.elasticsearch.gateway.MetadataStateFormat;