Folding of thin walled tubes as a free gradient discontinuity problem