US averts government shutdown with late-night Senate vote