Now, regarding the OP:
Although the above-described behaviour is better than the current "promote a child", and the default in piroor's Tree Style Tab; I'd argue that the tree-structure should be maintained when closing tabs. (See my other post, https://orionfeedback.org/d/10674-closing-a-parent-tab-should-retain-the-tree-structure-not-promote-a-child)
If you close a tab with children with children using ⌘W, I believe the sidebar's structure shouldn't change - the active page should be replaced with an 'empty' tab (about:blank
, basically, but whatever the browser currently uses with ⌘N), and the focus/viewport should move onwards to whatever the next-selected tab would be if it had closed.
If the user actively wants to remove the subtree, IMO, that's a separate user-intent, and needs a separate indication; but personally, I never want tree-structure information "thrown away" while I still have any of the children present. The whole point of tree-style tabs is to preserve and present metadata about a page that you may have forgotten while you were onwards to other tasks: "where did I find this page? why was I even here? what do I go back to doing when I finish on this page?" - the parent represents all of those things; and just because I don't need to keep interacting with the parent tab "as a wepgage" (and don't want it consuming the resources on my machine) doesn't mean those facts aren't still true.
Effectively, at least in the ways I've seen people using it, tree-style tabs are halfway between a history interface and a RAM-usage/activity-monitor interface: what have you been doing recently, and what is your browser currently still doing because of those actions you took. Surfacing information related to those two purposes, and controls to affect those two purposes, feels paramount. (=