US government shutdown averted in last-minute deal