Bug #2729: Fix the race condition for stdout destinations as well as
as file destinations