Have refactored the code to extract the parallel execution in a private method and calling from both the places. Also adjusted the close() as the executor was shutting down before the files were been processed