class_docstr: Launch a starcraft server, initialize a controller, and later, clean up.
  
  This is best used from run_configs, which decides which version to run, and
  where to find it.
  
  It is important to call `close` or use it as a context manager, otherwise
  you'll likely leak temp files and SC2 processes.
docstr: Shut down the game and clean up.
docstr_tok: ["Shut","down","the","game","and","clean","up","."]
code: def close(self):
      """Shut down the game and clean up."""
      if hasattr(self, "_controller") and self._controller:
          self._controller.quit()
          self._controller.close()
          self._controller = None
      self._shutdown()
      if hasattr(self, "_port") and self._port:
          if not FLAGS.sc2_port:
              portpicker.return_port(self._port)
          self._port = None
      if hasattr(self, "_tmp_dir") and os.path.exists(self._tmp_dir):
          shutil.rmtree(self._tmp_dir)
  
imports: import os
  import platform
  import shutil
  import subprocess
  import tempfile
  import time
  from absl import flags
  from absl import logging
  import portpicker
  from pysc2.lib import remote_controller
  from pysc2.lib import stopwatch
label_desc: Use image node_id 2 for calling the StarcraftProcess obj's underlying member method code with example usage: obj.close() without return types