def stop(self):
        """Terminate the subprocess and close resources."""
        if self._proc is not None:
            self._proc.terminate()
            self._proc = None
        if self._stdout_file is not None:
            self._stdout_file.close()
            self._stdout_file = None
Terminate the subprocess and close resources.
template/e2e/e2e_utils.py