Close duped output streams before returning
nostdout doesn't need to capture output