copyFile opens a temporary file without setting the close-on-exec flag. So if another thread execs a process at the same time, the process can inherit an open FD to a temp file. Specifically, in withReplacementFile, it uses OS.openBinaryTempFile.
copyFileWithMetadata and copyFileToHandle had this same problem fixed in commit 0ff4e13