Confinement of relativistic electrons in a magnetic mirror en route to a magnetized relativistic pair plasma