Change 'terminate' to 'stop' for app event. Also use ros::shutdown on close.