No the automatic 3 free relistings feature is totally separate to the 40 free listings limit.  It doesn't matter when the listing ends it will relist for free three times in total, and dioes not affect however many free listings you may have left.  Only new listings (or manually relisted ones) use up free listing allocations.

Cheers,

Penny