option to only print to stdout if pipe is closed