client.end should have a string argument, not an Error object.