Initialize the mutex
Log errors, flush queue synchronously on close calls