Fixed issue where the end pointer was not updated

If the end of the linked list is reached, the end pointer must be updated to no longer point at what was the last element in the list.