Truncate files before writing the template