The prisoner release was required by the "Islamic Emirate of Afghanistan" as part of a deal, which was intended to bring peace to Afghanistan, commonly referred to as The Doha Preace Agreement. But this agreement was broken in several ways at several stages, with increasing significance, post signing, by the Taliban.
The withdrawal sequencing could have been fairly adjusted as the agreement was broken by the other side first.