@Override
  public final void preTearDown() throws Exception {
    StringBuilder problems = new StringBuilder();

    if (cache != null) {
      try {
        if (remoteCloseCache()) {
          problems.append("An exception occurred trying to close the cache.");
        }

        assertTrue(cache == null);

      } catch (Exception ex) {
        String s = "While closing the cache in this VM";
        throw new InternalGemFireException(s, ex);
      }
    }

    for (int h = 0; h < Host.getHostCount(); h++) {
      Host host = Host.getHost(h);

      for (int v = 0; v < host.getVMCount(); v++) {
        VM vm = host.getVM(v);
        boolean exceptionInThreads = vm.invoke(DistributedCacheTestCase::remoteCloseCache);
        if (exceptionInThreads) {
          String s = "An exception occurred in GemFire system";
          problems.append(s);
        }
      }
    }

    assertEquals("Problems while tearing down", "", problems.toString().trim());
  }
Closes the cache in this VM and each remote VM
geode-core/src/distributedTest/java/org/apache/geode/internal/cache/DistributedCacheTestCase.java