Fixing race condition in handling unhandled exceptions. Fixes issue 3544