gfig: close file on parse errors

(cherry picked from commit 3ce761e3b30f5195ba2f2e0ffa4b16a742b10d69)
libgimpconfig: fix if condition

(cherry picked from commit d96096515e097a9f2e5d6797a8dffe22ea93308e)
(cherry picked from commit cf3e7bc40b7a2312d6acef76aed1b69b7a96106b)