Ravens clinch AFC playoff berth with 24-17 win over Bills