In this commit we fix the implementation of SettleInvoice by ensuring the lock is held for the duration of the method.