Use O_CLOEXEC for files that remain open for extended time

Tell the OS we're not interested in keeping these open across exec()
calls. This may help prevent running out of resources when calling a
function like system() which doesn't close everything. And it looks
to be good practice anyway.