Fix crash when closing and reopening window.