fileutil: Close fd if passed NULL for output stream
fileutil: Close fd if passed NULL for output stream

So we don't leak it.

Distrotech/libgsystem,GNOME/libgsystem,Distrotech/libgsystem,GNOME/libgsystem