The waiting list for planned treatments in the Welsh NHS has dropped by almost 2,000, the latest figures show.