More bestblock records in wallets

Write bestblock records in wallets:
* Every 20160 blocks synced, no matter what (before: none during IBD)
* Every 144 blocks after IBD (before: for every block, slow)
* When creating a new wallet
* At shutdown

This should result in far fewer spurious rescans.
Merge pull request #2682 from sipa/morewalletbb

More bestblock records in wallets