Apparatus for treating textiles