Nothing in this chapter shall prevent the owner from reasonably withholding payment or a portion of a payment to the contractor; provided, that such withholding is in accordance with the written contract between the owner and the contractor. The owner may also withhold a reasonable amount of retainage as specified in the written contract between the owner and the contractor; provided, however, that the retainage amount may not exceed five percent (5%) of the amount of the contract.