Merge "Add missing fclose() and open with O_CLOEXEC."