This will find all tap devices and try deleting all of them. Of course don't run this if there is a chance an unused tap device is necessary and would not be created by the script ro application using it.
for tap in `ifconfig -a|grep tap[0-255]|awk '{print $1}'`; do
tunctl -d $tap
done
linux, delete, unused, devices, automaticallythis, deleting, ro, ifconfig, grep, awk, tunctl,