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
email: "Exchange Services has stopped" - Rain of Exchange Javacrashes

Cleanup some nasty records containing NULL fields.

Author: Emmanuel Berthier <emmanuel.berthier@intel.com>
Signed-off-by: Shuo Gao <shuo.gao@intel.com>
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
Signed-off-by: Jack Ren <jack.ren@intel.com>
Author-tracking-BZ: 60461

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

Change-Id: Iec5e7e1bebc4beee8fa010c3f9c9ee723fd2cd83