finalize the log after all the involved processes exit