code: async def terminate(self) -> None:
          
          await asyncio.sleep(config.shutdown_wait)
          # stop server and close loop if no more connection exists
          if not is_connected():
              stop_server(self.application.server)
              self.application.loop.stop()
docs: Terminate server if no more connection exists.