Fix calculation of ends in ol.geom.MultiPolygon#getPolygons

This fixes a bug reported by @pagameba [on the mailing list](https://groups.google.com/d/msg/ol3-dev/mHUxePnRCC8/CQiK1Tr7zNIJ). The polygons returned by `ol.geom.MultiPolygon#getPolygons` were invalid.

@ahocevar I suspect that this same bug is present in other `ol.geom` classes, which in turn might be causing #1808. Will investigate.