Fixed issue with asynchronous batchloglistener flushing where there might be multiple flushes at the same time