Close the stringio object after saving and retrieving the head from it