On Close termlog waits for all messages to be written and flushes stdout