cleanup logs and add mutex around write to testresults.log