According to the docs:
Returns GIF_ERROR if something went wrong, GIF_OK otherwise.When GIF_ERROR is returned, the GifFile structure is not freed so that the diagnostic error code will remain accessible in GifFile->Error.
This behavior is a problem, because it's not always possible to free the struct afterwards. Case in point is a C# wrapper for giflib (or any language/environment where you can't just free objects allocated in a foreign shared library.) If EGifCloseFile() returns GIF_ERROR, there's no way to free the structure.
I think a better behavior would be for EGifCloseFile() to free the structure and return the actual error code (if there was one.)