purchase order - close during A/P Entry

We have the option to close a purchase order automatically set to when the balance is zero.  Is there a way to close a purchase order during accounts payable entry when the invoice is less than the total purchase order?