It seems to be fairly logical when looked at a UI layout PoV. The rows of lights seem to be centred in the height of the row of elements that they are alongside.
If there is just a title of the window in that row, the height of that row will likely be less and the lights would be closer to the top border of the window (than they are on other windows).
If other elements (such as a search box, or back/forward arrow buttons) are alongside the lights, then they will increase the height of that row, and the lights will be further from the top border. (as they are centred in its height).