Fixed bug

When the tpm files came from different folders, but with the same
basename, the output was iteratively overwritten, and the output
array pointed three times to the same filename, and thus it did not
crash.

Now, when using automatic name generation for outputs, the index is
always added to prevent this undesired situation.