Make JUnitReporter compatible with Ruby < 1.9.3.

IO.write is a new method as of Ruby 1.9.3, so use File.open and << instead.

There was no direct unit test of this behavior, but the gallery test was failing instead of writing test reports.