Adding more logging to see why the app isn't terminating