Window creation works. Doesn't close properly