Don't create empty transactions when reading corrupted wallet

The current transaction loading code is not exception safe.
An exception during deserialization causes an empty transaction
to be left behind in the wallet.

Fix this by building the transaction separately and adding
it only to the wallet at the end.

Fixes #3333.
Merge pull request #3426

16ec904 Don't create empty transactions when reading corrupted wallet (Wladimir J. van der Laan)