Tidy up mingw_popen

This also fixes piping output to a command in awk.