Add null check when closing pending requests.

In response to sporadic unit test failure.
Check to make sure that db is open before calling db.setLastSequence().

In reaction to seeing "java.lang.IllegalStateException: attempt to re-open an already-closed object: SQLiteDatabase" exceptions in unit test output.
Remove log noise