Fix Issue 11945 - LockingTextWriter.put

The function just had sloppy constraints while assuming it was a string. This fixes it up and adds some basic unit tests.

https://d.puremagic.com/issues/show_bug.cgi?id=11945