Why do patients with cancer visit the emergency department near the end of life?

Why do patients with cancer visit the emergency department near the end of life?