fix regenHandler shutdown.
fix regenHandler shutdown.

This fixes a case where queueRegenEvent blocks
indefinitely in regenHandler when template generator is shuting down.

jrick/dcrd,decred/dcrd,jrick/dcrd,decred/dcrd