Use narrowly scoped file descriptor for handling opened TTY in