Move activeWorktreeId/activeTabId clearing out of shutdownWorktreeTerminals (a terminal-focused store action) and into the UI component that triggers shutdown. The delete flow already handles this independently in worktrees.ts. Also fix pre-existing lint issues and extract terminal helpers to separate file. Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>