Fix the exception when we exit the sample app