modifications to optical finder

- added security check before deleting any intermediate files
- correcting a bug in how intermediate files are read before merging