cmd_util: close stdin in call_with_stdin