Plus browsers are sort of crazy, so I don't think mimicking their behavior is necessarily a good idea.
+1, I just tried Chrome, sometimes it went to previous, sometimes to the one on the right, I can't tell what makes the decision.
I think (without checking) in Geany it is simply that since notebook tabs are usually referenced by number counting from left, when the current tab is closed and the tab number isn't changed the tab that was on the right will now be that number and so the current one. So maybe there isn't any code for this, its simply what happens.