Not close window if use custom prototype with default close button.

I have implemented a custom windows prototype with default toolbar and close button.
If will be open 2 windows, close button works only for one of them.
Please see. Code Snippet

when you put an object into defaults, it becomes shared between all instances. thus when you try to close window, handler tries to find last created button’s topParentView and can’t find if it is closed.
you need to set such objects in $init method.
https://webix.com/snippet/d626fa13

Many thanks.