Use res.on('finish') rather than 'end'.