Strange. I use `map.getLayers().forEach(...)` directly here:

https://github.com/geoadmin/mf-geoadmin3/pull/126/files#L1R98

It seems work. Do you see problems with my approach?