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