Truncate the file to zero length on opening when "w" mode is set

This is the current behavior of MRI ruby.