Prevent rehashing of filenames

There's a problem if the filename has already had the hash appended to it, it will get appended again.

I added a check to make sure the suffix isn't already in the filename.

Trying again from #48