Implemented flushing of frames
Fixed encoding of animated gif