Fix GeometryCollection writing issue. Add a test for GeometryCollection.