I thought that `pw.close()`would also close the (wrapped) StringWriter. Then of course `sw.close()`does not make much sense, hmm.
I guess there is not much to be done to close a StringWriter anyway. Would expect it to use a StringBuilder/StringBuffer internally. 

So how could this be improved?