@staticmethod
def __cleanup_save_image_tasks(done, pending):
    """Cancel the pending tasks & raise exception in save_image_tasks."""
    for task in pending:
        task.cancel()
    for e in [task.exception() for task in done]:
        if e:
            raise e from None
