State ordered to plug orphaned oil and gas wells