Fix when keepalive option is set to false

And replace `console.log` by `grunt.log.write`.