Fixed leaked window issue