Made the finishFiles method functional