[Issue 10095] New: Race condition causing corruption of mutexes when closing the database