Auto file closing resize function

def resized(*args, **kwargs):
    """
    Auto file closing resize function
    """
    resized_image = None
    try:
        resized_image = resize(*args, **kwargs)
        yield resized_image
    finally:
        if resized_image is not None:
            resized_image.close()