Fixes an edge in "unhandledrejection" event that prevent synchronous errors being surfaced when throw from a top-level scope.