uses os.remove(fd) to close tmp file and change of error messages