Added interupt to DB thread

This speeds up DB shutdown by a great ammount, making tests run alot faster.
Merge branch 'master' into schema_upgrade