Small fix to write the gif to a file

Small fix to write the gif image in a file. Should also work for buffer.

The fix uses the WRITE macro in giflib to call our own write function since we already have our file handlers and write functions in Mapserver.