Made cleanupUploadStash use batching for the last two loops

Change-Id: If3cfd333636f5b14c529629ce1ec408d396122a8
(cherry picked from commit 7c13cc0097d2cb78dc7ba869a64436f0cc9c2b45)