Write cleaner promises using `Promise.withResolvers()`

If you need to pass around the `resolve` and `reject` functions of a `Promise` object, creating the promise using `Promise.withResolvers()` is a nicer API that reduces nesting.