Have the sorting program remove the tmp files when it's finished. This program could be much more efficiently designed.