The midterms determine which party controls Congress and were seen as a referendum on Donald Trump’s presidency.