Why were Afghanis who wanted to leave still there at the end?

Early 1970’s. Half a century ago.

Varies by country, of course, but at a minimum months and quite plausibly years, especially over the past year and a half due to covid travel restrictions.

OK - so they had 50 years to complete the paperwork.

Many of these people weren’t just refugees; they had worked for and with the US military as translators and, as I understand, had been promised that they’d get visas to come to the US.

Paperwork that isn’t accepted doesn’t get you anywhere.