Lawmakers pass budget in the last hours of session