code: def asyncClose(fn):
      
      @functools.wraps(fn)
      def wrapper(*args, **kwargs):
          f = asyncio.ensure_future(fn(*args, **kwargs))
          while not f.done():
              QApplication.instance().processEvents()
  
      return wrapper
docs: Allow to run async code before application is closed.