code: def close_remote(self):
          
          if self._remote:
              try:
                  # first see if remote dir is still there
                  self._remote.execute('ls %s' % (self._remote_id,))
                  if self.status != 'Completed':
                      self.remove()
                  self._remote.execute('rm -rf %s' % (self._remote_id,))
              except RuntimeError:
                  pass
              self._remote.close()
              del self._remote
docs: Cleans up and closes connection to remote server if defined.