chore(gatsby): Deregister all events to the queue after batch (#20798)
chore(gatsby): Deregister all events to the queue after batch (#20798)

The queue was retained for develop mode which led to the same event handlers being registered over and over again, which led to strange artifacts in the output.

With this change the events are aggressively deregistered from the queue when it finishes or fails.

Fixes #20787
gatsbyjs/gatsby,gatsbyjs/gatsby,gatsbyjs/gatsby,gatsbyjs/gatsby,gatsbyjs/gatsby,gatsbyjs/gatsby