Mayank, thanks for the patch!
I like your idea of using JIP.garbageCollect, but the more I look into it, the more I'm worried about JIP.garbageCollect. This is because it does a whole lot of other cleanup (metrics, JT.finalizeJob, JobHistory cleanup etc. etc.) which aren't implemented defensively enough. For e.g. JobHistory.logSubmitted is called in JIP.initTasks, but JT.finalizeJob calls JobHistory.markCompleted which breaks stuff badly.
So, I propose a simpler solution: let's move the code in garbageCollect which does cleanup of:
localJobFile, job-system-dir, DelegationTokenRenewal.removeDelegationTokenRenewalForJob and fs.close
Then JIP.garbageCollect can use that too.