Long hours, last-minute changes to finish state budget