A Question about DoubleLinkedList.remove(_:)

In the method of removing nodes, After completing this operation: prev.next = next && next?.previous = prev

it seems that the node has no more strong reference. At this time, the node should have been destroyed, but in the end why can ”return the node value“?

here is code in the resource file:
QueueChallenge → Sources → DoubleLinkedList.swift → remove function

public func remove(_ node: Node<T>) -> T {
    let prev = node.previous
    let next = node.next
    
    if let prev = prev {
      prev.next = next // 👈 here
    } else {
      head = next
    }
    
    next?.previous = prev // 👈 here
    
    if next == nil {
      tail = prev
    }
    
    node.previous = nil 
    node.next = nil
    
    return node.value // 👈 here
  }

What chapter/section does this pertain to?

Delete a node from a singly connected linked list. You will not be given the head of the list.
You will be given a node to be deleted. That node will not be the tail node in the linked list.
The node to be deleted will always be in the linked list.
Delete the node in place and no return value needed.
Input: head = [1,5,2,3,4], node = 2
Output: [1,5,3,4]
class DeleteANodeInLinkedList {
public void deleteNode(ListNode node) {
while(node!=null){
if(node.next!=null){
node.val=node.next.val;
if(node.next.next==null){
node.next=null;
}
}
node=node.next;
}
}
}
Found this linked list problem in kuickcode dot com , there are many algo nicely explained.