replace output files atomically

.. well on unix anyway
work in parallel via threads

since things like fetching URLs involves lots of latency, a modest
number of threads is expected to improve throughput.
fix whitespace