Potential NPE in Account.

Also, avoid calling close() if the cursor is already closed.

This was merged in AOSP: https://android-review.googlesource.com/#/c/45703/

Change-Id: I5e077a03e437721b8fc7ffb9af284eaa405d901e