finish the loop