How about emptying the map with `map.getLayers().clear()`?