Fixing memory leaks in AbstractWindow.