The 222-to-209 House vote sent the legislation to President Trump’s desk, heralding an end to the shutdown after 43 days.