Trapping by static sinks: An exact result based on fluctuating nonequilibrium thermodynamics