NullValueException: execution doesn't exist: execution is null

In addition to Jan’s comment, here’s how you can do things after the current transaction is committed: Why can’t I see the end event during a process instance end event listener?

However, keep in mind that in case when your transaction listener fails that the process engine transaction won’t be rolled back. So you may need proper error handling to avoid losing history events.

Cheers,
Thorben