No, Gap insurance does not pay out if the policyholder and car owner dies before their car loan is paid off. If your spouse dies and they still owe on a vehicle there may be other coverages or insurance that your spouse had in place (such as life insurance) whose payouts could help you have the money to pay off a financed vehicle, however Gap insurance does not cover the balance of the loan if the policyholder dies.
A standard Gap insurance policy could have a claim made against it to cover the balance of a loan after the covered vehicle has been in a total loss situation. This means that the vehicle was totaled out after an accident or stolen normally. When the primary insurance on a vehicle declares the car a total loss the car owner's physical damage coverage, Collision or Comprehensive, coverage should pay out actual cash value (ACV) for the vehicle. Once the ACV was paid out then Gap insurance usually then pays its portion to cover the difference of the ACV and the amount still owed on the vehicle.
Once again, a total loss of a vehicle typically comes after a car is severely damaged in an auto accident. It can also be declared to be totaled by an insurer if your motor vehicle is stolen and damaged or stolen and unrecovered. A car is not found to be a total loss if the car owner dies and thus no ACV is paid thus Gap insurance would not be available to make a claim against.
If the policyholder dies and still has a loan on their car then the estate, spouse or next of kin of that person would typically need to see about taking over the loan, turning the car back into the lien holder, etc. You can check to see when your spouse financed the vehicle if he was offered insurance on that loan that would pay it off if he died. This may be a form of life insurance offered or sometimes it is called finance or creditor insurance.
If your spouse died and was the car owner and policyholder for the car's insurance then you would also need to contact the automobile insurance company and notify them of the death and either transfer insurance over to the person taking over the car or cancel the policy.
Death benefits are not a part of Gap insurance. If however the Gap policyholder was killed in an auto accident where their car was totaled out and the ACV was paid out then Gap should cover any balance left on the loan or lease, this though is just the policy paying out the same as it would if the insured was alive and had not died in the motor vehicle accident.