VK1ET : Better pthread termination

Close threads, mutex and conditions using pthread functions

Also, correct/update a few comments.