Fixed bug where window could not be recreated after being freed