fixed ordering issue using index in forEach with parseDocumentDirectory

added processedCount to populateCollections to ensure that next is only
called when all paths have been processed.