Fix memory leak

This is a crude attempt at fixing the memory leak caused by code like:

```js
function next() {
  return new Promise(function (resolve) {
   setImmediate(resolve)
  }).then(next)
}
next()
```

In theory this should be a viable way of running a continuous polling operation.