Add support for giflib version >= 5.1.0

DGifCloseFile has changed.
NB: Old commit here: fb0c4e6a5eca7a395f1c71964f7223308d6699db