async def _cleanup_subprocess(self, process):
        """Kill the given process and properly closes any pipes connected to it."""
        self._log.debug(f"Cleanup Subprocess (pid {process.pid})")
        if process.returncode is None:
            try:
                process.kill()
                return await asyncio.wait_for(process.wait(), 1)
            except asyncTimeoutError:
                self._log.debug(
                    "Waiting for process to close failed, may have zombie process.")
            except ProcessLookupError:
                pass
            except OSError:
                if os.name != "nt":
                    raise
        elif process.returncode > 0:
            if process.returncode != 1 or self._eof_reached:
                raise TSharkCrashException(f"TShark (pid {process.pid}) seems to have crashed (retcode: {process.returncode}).\n"
                                           f"Last error line: {self._last_error_line}\n"
                                           "Try rerunning in debug mode [ capture_obj.set_debug() ] or try updating tshark.")
Kill the given process and properly closes any pipes connected to it.
src/pyshark/capture/capture.py