Coherent control of terahertz emission and carrier populations in semiconductor heterostructures