This code must work only for close polyline. Some times the first and the last vertex of the polyline is in the same point but the polyline is not close. So you try to run the code and you dont take any results and you dont know why untill find out that the polyline is not close or the close polyline you select is not in the correct layer. Thats why i want this two filters
Thanks