Preparation of thin polymer films