Fix issue when generated file is smaller than previous one, size of the file was not truncated.