Vulnerability: User is unable to partially payback loan if they aren't able to post enough isoUSD to bring them back to minOpeningMargin
Severity: high

Description:
The only way for a user to reduce their debt is to call closeLoan. If the amount repaid does not bring the user back above minOpeningMargin then the transaction will revert. This is problematic for users that wish to repay their debt but don't have enough to get back to minOpeningMargin as it could lead to unfair liquidations.\\n```\\n    if(outstandingisoUSD >= TENTH_OF_CENT){ //ignore leftover debts less than $0.001\\n        uint256 collateralLeft = collateralPosted[_collateralAddress][msg.sender] - _collateralToUser;\\n        uint256 colInUSD = priceCollateralToUSD(currencyKey, collateralLeft); \\n        uint256 borrowMargin = (outstandingisoUSD * minOpeningMargin) / LOAN_SCALE;\\n        require(colInUSD > borrowMargin , "Remaining debt fails to meet minimum margin!");\\n    }\\n```\\n\\nThe checks above are done when a user calls closeLoan. This ensures that the user's margin is back above minOpeningMargin before allowing them to remove any collateral. This is done as a safeguard to block loans users from effectively opening loans at lower than desired margin. This has the unintended consequence that as user cannot pay off any of their loan if they do not increase their loan back above minOpeningMargin. This could prevent users from being able to save a loan that is close to liquidation causing them to get liquidated when they otherwise would have paid off their loan.

Impact:
User is unable to make partial repayments if their payment does not increase margin enough

Recommended mitigation:
I recommend adding a separate function that allows users to pay off their loan without removing any collateral:\\n```\\nfunction paybackLoan(\\n    address _collateralAddress,\\n    uint256 _USDToVault\\n    ) external override whenNotPaused \\n    {\\n    _collateralExists(_collateralAddress);\\n    _closeLoanChecks(_collateralAddress, 0, _USDToVault);\\n    //make sure virtual price is related to current time before fetching collateral details\\n    //slither-disable-next-line reentrancy-vulnerabilities-1\\n    _updateVirtualPrice(block.timestamp, _collateralAddress);\\n    (   \\n        bytes32 currencyKey,\\n        uint256 minOpeningMargin,\\n        ,\\n        ,\\n        ,\\n        uint256 virtualPrice,\\n        \\n    ) = _getCollateral(_collateralAddress);\\n    //check for frozen or paused collateral\\n    _checkIfCollateralIsActive(currencyKey);\\n\\n    uint256 isoUSDdebt = (isoUSDLoanAndInterest[_collateralAddress][msg.sender] * virtualPrice) / LOAN_SCALE;\\n    require( isoUSDdebt >= _USDToVault, "Trying to return more isoUSD than borrowed!");\\n    uint256 outstandingisoUSD = isoUSDdebt - _USDToVault;\\n\\n    uint256 collateral = collateralPosted[_collateralAddress][msg.sender];\\n    uint256 colInUSD = priceCollateralToUSD(currencyKey, collateral); \\n    uint256 borrowMargin = (outstandingisoUSD * liquidatableMargin) / LOAN_SCALE;\\n    require(colInUSD > borrowMargin , "Liquidation margin not met!");\\n    \\n    //record paying off loan principle before interest\\n    //slither-disable-next-line uninitialized-local-variables\\n    uint256 interestPaid;\\n    uint256 loanPrinciple = isoUSDLoaned[_collateralAddress][msg.sender];\\n    if( loanPrinciple >= _USDToVault){\\n        //pay off loan principle first\\n        isoUSDLoaned[_collateralAddress][msg.sender] = loanPrinciple - _USDToVault;\\n    }\\n    else{\\n        interestPaid = _USDToVault - loanPrinciple;\\n        //loan principle is fully repaid so record this.\\n        isoUSDLoaned[_collateralAddress][msg.sender] = 0;\\n    }\\n    //update mappings with reduced amounts\\n    isoUSDLoanAndInterest[_collateralAddress][msg.sender] = isoUSDLoanAndInterest[_collateralAddress][msg.sender] - ((_USDToVault * LOAN_SCALE) / virtualPrice);\\n    emit ClosedLoan(msg.sender, _USDToVault, currencyKey, 0);\\n    //Now all effects are handled, transfer the assets so we follow CEI pattern\\n    _decreaseLoan(_collateralAddress, 0, _USDToVault, interestPaid);\\n}\\n```\\n