Gold near $4,000 as Iran war, central bank buying reshape outlook