Thank You ! That Worked.
here’s the code I used:
((Window) getWindow().getParent()).removeWindow(getWindow());