Database instance is now destroyed with the Database object

This fixes about 100 valgrind errors.
Clean up dbPath after tests
Fixed workerthread not deleted after join