The effect of magnetospheric erosion on mid- and high-latitude ionospheric flows