When you select a tab (tab L), right click its tab button, and pick "New Tab", Firefox creates a new tab (tab N) immediately to the right of the current tab. My contention is that when this new tab is selected and closed, instead of making the tab to the right of its position (tab R) active, it should make active the tab that was selected when the new tab was created, which is L.
R may have nothing to do with L or N, and may be unloaded and left over from a previous session, when the browser is set to restore all tabs from the previous session. In my experience, the consequence of the current way, loading R on close, is that a tab that I have no intention of interacting with frequently gets loaded for no good reason.