If stdin is a tty and dmenu is ran with the fast option then it's impossible to close stdin because the keyboard is already grabbed.