added code to loop through files, and remove all objects each time, to try to save more memory