When money has been deposited, if it remains on deposit at the time of a judgment for the payment of a fine, the court, or the clerk under the direction of the court, shall apply the money in satisfaction thereof, and after satisfying the fine and costs shall refund the surplus, if any, to the person who deposited the bail, unless that person has directed, in writing, that any surplus be refunded to another.
NRS 178.528