Fix tests on FreeBSD

FreeBSD throws errors if you pass flags like O_WRONLY to mkostemp.
Pass only O_CLOEXEC.