The University of Maryland, Baltimore needed to spend more than $2.9 million to cover losses at a downtown apartment building it owns as vacancies rose and revenue plummeted during the pandemic.