Rewrite code to write animated GIF from GIFFrames