Update wallet.cpp

Fixes for scope of scriptpubkeyout