Fix generation of file suffix so that the loop does not append to it.