build-remote.pl: Pass /dev/null as SSH's stdin

Otherwise it will set the parent's stdin to non-blocking mode, causing
the subsequent read of the set of inputs/outputs to fail randomly.
That's insane.
build-remote.pl: Properly close the SSH connection between attempts