Once the credit/payment has been applied to any open invoices and there is still a balance left, that credit balance can remain unapplied so that it can be applied to future invoices, or you can refund the balance.
 

Refer to How to automatically apply payments/credits to an invoice for more information on the business rule that governs payments/credits application.