[SPARKR-113] Use temporary files for input instead of stdin

This fixes a bug for Windows where stdin would get truncated. This is the first step for the Windows build and I'll send a follow up PR with a `Makefile.win` and `install-dev.bat`