Added Finalizer.

Allows for finalizing the writes to the file, writes all pending strings and then stops the thread.