use piping to redirect output. This keeps the output file open.