Transformations of the Micro-Domain Structure of Polyimide Films during Thermally Induced Chemical Conversion: Characterization via Thermodynamics of Irreversible Processes