Express error: write after end
<p>I'm having issues with this code I'm trying to write. For some reason I get the error listed in the title. I'm pretty sure this is an issue with the async concept. How can I fix this?</p>

<pre><code>pokeRouter.get('/sightings/:value([a-z]+)', function (req, res) {
var test = {};
pokemon.find().each(function(err, item) {
    if (item == null) {
        res.end();
    } else if ((req.params.value == item.type1) || (req.params.value == item.type2)) {
        sightings.find({pokedex_id: item._id}).toArray(function(err, docs) {
            if (docs == null) {
                return null;
            }
            res.write(JSON.stringify(docs));
        });
    }
});
});
</code></pre>