France held off a second-half rally to beat Canada and advance to the men’s basketball semifinals at the Paris Olympics.