Two fixes

fix returning error on insertTx and doSpend.
clear the batch on failures as well.