Switched to using File.open semantics for writing to be compatible with
ruby-1.8.7.