Add check for duplicate filenames

Quit with an error in validation if duplicate filenames are found (to
prevent files being accidentally overwritten)