Thermal treatment in the presence of solvent vapors