fix temp file name issue. allow .gz to be not only in end of file since the temp file is adding some random text at end of file name