Field-aligned currents and erosion of the dayside magnetosphere