fixed leaked window in ptr