Shutdown simulator when closing viewer window