Amazon shares fell 5.1% in after-hours trading after the company reported a full-year loss in 2022, its first unprofitable year since 2014.