Make sure to truncate the file