Prevent NPE for corrupt accounts If an account is encountered where the external IDs exist but not the actual account entry, a NPE would result. Instead, prevent the NPE and throw an UnloggedFailure, and also guard the DB access from leaking resources with a try/finally. Change-Id: Id6416bb6f365d6eaf552e3b7cf108e13cc69154b