Closes #2318: getMaxZoom returns prev layer on baselayerchange

Remove all old layers before adding new ones to avoid
the old properties being returned in the baselayerchange handler.