helpers: Fix use-after-free closing standard output
In these two helpers, original_stdout is automatically freed on exit from its scope, so we must not close it in a way that leaves a dangling pointer to the freed object.
Fixes: 44df5dfa "helpers: Warn if closing stdout fails"