Log2File: preventing a potential race condition in .write callback while closing