Add lock variable to fix botlogs_capture.txt IO exception when multiple threads access this file

The test harness crashes because of concurrent file access.