in reply to reuse STDOUT after it was closed

There's a module (Hook::Output::File) that does exactly that.