Total-cross-section measurements for positrons and electrons colliding with H2, N2, and CO2