Fix for lockunspent returning true even for non-existent outputs

lockunspent will now validate all of the provided outputs are
both unspent and belong to the local wallet.

The operation is now also atomic.

Fix for #2667