According to man page fclose(3):
RETURN VALUE
Upon successful completion 0 is returned. Otherwise,
EOFis return
This fclose() issue seems to be a legacy of FreeBSD, and was accepted uncritically by both the Microsoft and Linux camps.
But HP, SGI, Solaris, and CYGWIN, on the other hand, all handle fclose(NULL) reasonably. For example, man fclose for CYGWIN, which uses newlib rather than the OP's glibc, states:
fclose returns 0 if successful (including when FP is NULL or not an open file)
See https://stackoverflow.com/a/8442421/318716 for a related discussion.