Add a unit-test to verify that when statements throw exceptions, the logger still has stopQuery called.