Fixes an issue with throw in async function execution