Potential NPE in Account.

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

Change-Id: I5e077a03e437721b8fc7ffb9af284eaa405d901e