code: @Override
      public void close() {
          if (!this.closed.getAndSet(true)) {
              // Close all containers that are still open.
              ArrayList<CompletableFuture<Void>> results = new ArrayList<>();
              synchronized (this.handles) {
                  ArrayList<ContainerHandle> toClose = new ArrayList<>(this.handles.values());
                  for (ContainerHandle handle : toClose) {
                      results.add(this.registry.stopContainer(handle, CLOSE_TIMEOUT_PER_CONTAINER));
                  }
              }
  
              // Wait for all the containers to be closed.
              Futures.await(Futures.allOf(results), CLOSE_TIMEOUT_PER_CONTAINER.toMillis());
          }
      }
docs: region AutoCloseable Implementation