Don't assume that we'll close our db after saveRecentQuery

Also check for the case where we try to create a mergecursor
with empty array.

b/17879155

Change-Id: I0e5339248ba04d1ed6fc1734ab11e129a06e2290
2 files changed