Deal reached to avoid government shutdown