Fix issue when dispatcher's finalizer is called with an exception set

Fix issue #664