Window closing proper fix