code: def close(self):
          
          # make sure the environment hasn't already been closed
          if self._env is None:
              raise ValueError('env has already been closed.')
          # purge the environment from C++ memory
          _LIB.Close(self._env)
          # deallocate the object locally
          self._env = None
          # if there is an image viewer open, delete it
          if self.viewer is not None:
              self.viewer.close()
docs: Close the environment.