Fix thread leaks in unit tests

Now all the tests can be run with a single command:
$ adb shell am instrument -w com.android.providers.contacts.tests

Bug 26253504

Change-Id: I46bc7c54e4812e6171fb2078f21c1460b4734c96
4 files changed