To reproduce:
Darling [~]$ mktemp # works
/tmp/tmp.HwLVahuF
Darling [~]$ mktemp | cat
Darling [~]$
mktemp is in fact one of the few programs that do not call fflush or exit manually, thus exposing the issue.
dyld does exit(main(argc-1, &argv[1], envp)), but that's its own exit from host's libc, and it knows nothing about buffered I/O and whatever else Darling's/FreeBSD's libc wants to flush/close/dealloc at exit.
Good news is this will also get fixed after move to Mach-O.
Most helpful comment
Good news is this will also get fixed after move to Mach-O.