Truncating before writing