Destucting view components defined with UIScope

For keeping Views status, I’m using UIScope annotation to Views based on Navigation Tab.
In this case, when the tab associated with view be closed i want to immediately destruct the view instance.
Is it possible to do this?
I’m using Vaadin 14 + Spring Boot.

@Route(value = "accounts", layout = MainLayout.class)
public class Accounts extends ViewFrame {

I found out the solution for my question.

VaadinUIScope bean allows removing componets in UI scope.

public class MainLayout extends FlexBoxLayout
		implements RouterLayout, PageConfigurator, AfterNavigationObserver {
	public MainLayout(@Autowired VaadinUIScope vaadinUIScope) {
		this.vaadinUIScope = vaadinUIScope;
	public void removeUIScopedView(Class<? extends Component> target) {
		String str = target.getSimpleName();
		str = str.substring(0, 1).toLowerCase() + str.substring(1);
		// removes compoent in current ui scope

public class NaviTabs extends Tabs {
	public void closeTab(ClosableNaviTab tab) {
		long count = getChildren().filter(x->x instanceof Tab && ((Tab) x).getLabel().equals(tab.getLabel())).count();
		if (count == 0) {