A mechanism for heating electrons in the magnetopause current layer and adjacent regions