Implemented a queue to solve severe memory leaks issue

The task was not well suited for many files because it instantly spawned as many subprocesses as there were files. This changes introduces a concurrent parameter that only allows a certain number of subprocesses to be run concurrently.