Delete duplicates from a doubly linked list