US government shutdown averted hours before deadline