The G.O.P. was able to avoid more House midterm losses — on top of the advantage it already had from gerrymandering.