TIL: glibc writes internal error messages directly to /dev/tty (!) and when it can't it sometimes writes to STDERR_FILENO (probably, but not always, stderr). See https://github.com/lattera/glibc/blob/a2f34833b1042d5d8eeb263b4cf4caaea138c4ad/sysdeps/posix/libc_fatal.c#L62-L69 …. Takeaway #1: Never `close(STDERR_FILENO);` Instead reopen /dev/null using STDERR_FILENO.
I think we just have to assume, as library users, that this is what libraries will do. I think it glibc wasn't already doing it then it would make more sense to avoid doing it. It seems much safer than `fwrite(stderr)`, at least.