Submitted by hickuphh3, also found by rayn and WatchPug
LenderPool.sol#L404-L406
_principalWithdrawable is denominated in the borrowAsset, but subsequently treats it as the share amount to be withdrawn.
The amount of shares to withdraw can simply be _sharesHeld.
Note that this comes with the assumption that terminate() is only called when the credit line is ACTIVE or EXPIRED (consider ensuring this condition on-chain), because _sharesHeld excludes principal withdrawals, so the function will fail once a lender withdraws his principal.
ritik99 (Sublime) confirmed
