Remove polyline safely

When a polyline is removed from the map:
* Remove it from the internal polyline list
* `that._map` becomes `null`, so add safety code