Fixed crash when creating window, deleting it and creating a new one