Potential NPE in Account.

Also, avoid calling close() if the cursor is already closed.
Signed-off-by: Sylvain Becuwe <sylvain.becuwe@gmail.com>

Merged in AOSP: https://android-review.googlesource.com/#/c/45703/

Change-Id: I5e077a03e437721b8fc7ffb9af284eaa405d901e
Merge "Potential NPE in Account." into jb-mr1