Fixed issue where threads shared same output file stream