Dual Tab Status Issue

When closing the last tab of a dual file display lister, DOpus still identifies the lister status as dual. Is that correct? What might I be doing or interpreting incorrectly?

function OnInit(initData)
{
	initData.name = "TestDual";
	initData.version = "1.0";
	initData.copyright = "(c) 2024 Chuck";
//	initData.url = "https://resource.dopus.com/c/buttons-scripts/16";
	initData.desc = "";
	initData.default_enable = true;
	initData.min_version = "13.0";


}

var fsu = DOpus.FSUtil();
var tab;
var cmd = DOpus.Create().Command();

function testDual(lister) {
	tab = lister.activetab;
	cmd.SetSourceTab(tab);

	if (tab.lister.dual == 1) {
		DOpus.Output('TestDual (=1) = ' + tab.lister.dual);
		} else {
			if (tab.lister.dual == 2) {
				DOpus.Output('TestDual (=2) = ' + tab.lister.dual);
		} else {
			DOpus.Output('TestDual (=0) = ' + tab.lister.dual);
		}
	}
}

function OnCloseTab(closeTabData) {
	DOpus.Output('OnCloseTab = ' + closeTabData.tab);	
	testDual(closeTabData.tab.lister);
}	

Just a wild guess here Chuck, tab.lister.dual inherits from tab so closing a tab results in 1 rather than 2 ???
As everyone knows, I'm only beginning to understand this scripting.
Sorry if I'm wrong.

I learned something here about functions. I didn't know (=#) could be included that way.
Thanks for your input. It is helping me !

This lister is still in dual mode when you read the property. You could use the number of tabs to determine if it will be in single-display mode after the tab has been closed.

The CloseTabData.tab property identifies the tab that is closing. You can return True from this event to prevent the tab from closing, or False (which is the default) to allow it to close.

OnCloseTab

I'll take a look, thanks.