Fixed bugs to ensure better cleanup of JobScheduler, JobGenerator and NetworkInputTracker upon close.
Changed StreamingContext.stopForWait to awaitTermination.