The Senate on Friday narrowly averted a government shutdown at midnight, passing a G.O.P.-written stopgap spending measure ...