Fix bug: clear parent when deleting window.