Use isFinishing() instead

As suggested by @maniac103
https://github.com/k9mail/k-9/commit/41570e4#commitcomment-7388209
Synchronize access to sClientCertificateReferenceWorkaround

Also, refactor for easier readability.
Remove KeyChainKeyManager's dependency on 'K9.app'
Make fields in KeyChainKeyManager final
Merge remote-tracking branch 'upstream/master'
Merge remote-tracking branch 'upstream/tls-client-cert-auth'