fix for issue #286 (ExternalTool not re-opening {output} file)

fixes issue #286, where ExternalTool does not re-open {output} files, and therefore misses any output file that was *moved* into the temporary location (rather than written directly into).

it also switches I/O with the temporary files to binary-mode to avoid accidentally modifying text-mode data.