When the modified content in being written out the existing file isn't truncated. As a result, if the new content is shorter than the existing content by n bytes, n bytes of the previous content will remain at the end of the file.