window: fix a memleak
window: don't update the clip of closed window