Escaping near-relativistic electron beams from the solar corona