President Donald Trump signed an $854 billion spending bill on Friday to keep the federal government open through Dec. 7, averting a government shutdown in the weeks leading up to the November midterm elections.

Trump signed the legislation to fund the military and several civilian agencies without journalists present, according to a White House official, who spoke on condition of anonymity to discuss the action. The House and Senate approved the spending plan earlier this week.

Trump's signature avoids a shutdown before the Nov. 6 elections that will determine control of Congress. But he has expressed deep frustration that the bill does not pay for his long-promised wall along the U.S.-Mexico border. GOP leaders had warned Trump a shutdown could be deeply damaging to Republicans, but Trump had made the case a shutdown could, in fact, be beneficial.

The spending plan includes $675 billion for the Defense Department and increases military pay by 2.6 percent, the largest pay raise in nine years.