<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 async def _cleanup_subprocess(self, process):
 """ Kill the given process and properly closes any pipes connected to it. """

        if process.returncode is None:
            try:
                process.kill()
                return await asyncio.wait_for(process.wait(), 1)
            except concurrent.futures.TimeoutError:
                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:
            raise TSharkCrashException('TShark seems to have crashed (retcode: %d). '
                                       'Try rerunning in debug mode [ capture_obj.set_debug() ] or try updating tshark.'
                                       % process.returncode)