Fix beug with #next raising after the end

... instead of the old behavior or just returning nil again
Add spec for fixed bug
Land #2854, #next nil beug fix