The formula locks used by the installer and commands like link and
unlink are backed by open files and flock(). The open file descriptors
are thus leaked to any subprocesses. This can result in weird behavior
in programs spawned from formula that do not expect to inherit these
descriptors.
Fix this by setting close-on-exec on the lock file descriptors.
FixesHomebrew/homebrew#21486.