Giroud agrees deal to leave Chelsea