US averts government shutdown as Congress passes spending bill