class_docstr: Creates a multiprocess wrapper for multiple environments, distributing each environment to its own
  process. This allows a significant speed up when the environment is computationally complex.
  For performance reasons, if your environment is not IO bound, the number of environments should not exceed the
  number of logical cores on your CPU.
  
  .. warning::
      Only 'forkserver' and 'spawn' start methods are thread-safe,
      which is important when TensorFlow sessions or other non thread-safe
      libraries are used in the parent (see issue #217). However, compared to
      'fork' they incur a small start-up cost and have restrictions on
      global variables. With those methods, users must wrap the code in an
      ``if __name__ == "__main__":`` block.
      For more information, see the multiprocessing documentation.
  
  :param env_factories: A list of functions that will create the environments
      (each callable returns a `MultiStepEnvironment` instance when called).
  :param start_method: Method used to start the subprocesses.
         Must be one of the methods returned by multiprocessing.get_all_start_methods().
         Defaults to 'forkserver' on available platforms, and 'spawn' otherwise.
class_docstr_tok: ["Creates","a","multiprocess","wrapper","for","multiple","environments",",","distributing","each","environment","to","its","own","process",".","This","allows","a","significant","speed","up","when","the","environment","is","computationally","complex",".","For","performance","reasons",",","if","your","environment","is","not","IO","bound",",","the","number","of","environments","should","not","exceed","the","number","of","logical","cores","on","your","CPU",".","..","warning",":",":","Only","'forkserver","'","and","'spawn","'","start","methods","are","thread-safe",",","which","is","important","when","TensorFlow","sessions","or","other","non","thread-safe","libraries","are","used","in","the","parent","(","see","issue","#","217",")",".","However",",","compared","to","'fork","'","they","incur","a","small","start-up","cost","and","have","restrictions","on","global","variables",".","With","those","methods",",","users","must","wrap","the","code","in","an","``","if","__name__","==","``","__main__","''",":","``","block",".","For","more","information",",","see","the","multiprocessing","documentation",".",":","param","env_factories",":","A","list","of","functions","that","will","create","the","environments","(","each","callable","returns","a","`","MultiStepEnvironment","`","instance","when","called",")",".",":","param","start_method",":","Method","used","to","start","the","subprocesses",".","Must","be","one","of","the","methods","returned","by","multiprocessing.get_all_start_methods","(",")",".","Defaults","to","'forkserver","'","on","available","platforms",",","and","'spawn","'","otherwise","."]
docstr: VectorEnv implementation
docstr_tok: ["VectorEnv","implementation"]
code: def close(self) -> None:
      """VectorEnv implementation"""
      if self.closed:
          return
      if self.waiting:
          for remote in self.remotes:
              remote.recv()
      for remote in self.remotes:
          remote.send(("close", None))
      for process in self.processes:
          process.join()
      self.closed = True
  
imports: import multiprocessing
  from typing import Callable, List, Iterable, Any, Tuple, Dict, Optional
  import cloudpickle
  import matplotlib
  import numpy
  from maze.core.annotations import override
  from maze.core.env.action_conversion import ActionType
  from maze.core.env.maze_env import MazeEnv
  from maze.core.env.observation_conversion import ObservationType
  from maze.core.log_stats.log_stats import LogStatsLevel
  from maze.core.wrappers.log_stats_wrapper import LogStatsWrapper
  from maze.train.parallelization.vector_env.structured_vector_env import StructuredVectorEnv
  from maze.train.parallelization.vector_env.vector_env import VectorEnv
  from maze.train.parallelization.vector_env.vector_env_utils import disable_epoch_level_stats
  from maze.train.utils.train_utils import stack_numpy_dict_list, unstack_numpy_list_dict
label_desc: Use image node_id 6 for calling the SubprocVectorEnv obj's underlying member method code with example usage: obj.close() without return types