Add O_CLOEXEC to open calls

Just going through and cleaning up old issues. This addresses the request in #1329 to add `O_CLOEXEC` to open calls in the library to make things easier for library users that want to call `execv`, etc. Seems to me like there is no reason not to do this...