exit stream writing if it is a txt file