Close all unneeded file descriptors before exec.
Make the new terminal a controlling one.