WriteAndClose changed to use AddCorsHeader