Rewrite chat-logger to avoid leaking open streams

The chat logger was opening, and never closing, a large number of file
streams -- possibly contributing in a big way to bad performance under
load.  Rewrite to very perspicuously only maintain a single writeable
stream per filename.