Fix a memory leak, thanks valgrind!
Merge branch 'develop' into separate-close-thread