Dynamics of particle aggregation in evaporating and dewetting films of complex liquids