async def _close_common(self) -> None:
    self.is_closed = True
    self.cancel_task_safe(self.connect_peers_task)
    self.cancel_task_safe(self.serialize_task)
    self.cancel_task_safe(self.cleanup_task)
    for t in self.pending_tasks:
        self.cancel_task_safe(t)
    if (len(self.pending_tasks) > 0):
        (await asyncio.wait(self.pending_tasks))
    (await self.connection.close())
async def _close_common(self) -> None:
    self.is_closed = True
    self.cancel_task_safe(self.connect_peers_task)
    self.cancel_task_safe(self.serialize_task)
    self.cancel_task_safe(self.cleanup_task)
    for t in self.pending_tasks:
        self.cancel_task_safe(t)
    if (len(self.pending_tasks) > 0):
        (await asyncio.wait(self.pending_tasks))
    (await self.connection.close())