...and truncate the file if you intend to write less than the previous content of the file.