The staff were seized when the gunmen burst into the consulate in the Libyan capital, in the latest attack targeting foreign citizens and diplomatic missions in the lawless nation.
Libya descended into chaos after a revolt unseated longtime dictator Moamer Kadhafi in 2011.
It now has rival governments and parliaments, as well as powerful militias battling for influence and a share of its oil wealth, including the Fajr Libya militia alliance that controls Tripoli.
"After this serious incident (kidnapping), we have decided to close the consulate in Tripoli," Baccouche told reporters.
More From This Section
He was speaking at the L'Aouina military airport in Tunis, as he awaited the return of the former hostages.
"We will not reopen the consulate as long as protection for our civil servants is not guaranteed," Baccouche said.
"When that protection becomes available, we will rethink" our options, said Baccouche, whose country has a consulate in Tripoli and another in the east of Libya.
Their release comes as Tunisian officials and media reports said a Libyan militia leader detained in Tunisia would be deported as part of a deal with the kidnappers.
The prosecutor's office told AFP that the man, identified in media reports as Walid Glib, had been detained on suspicion of "involvement in terrorist affairs".
Spokesman Karim Chebbi said the "criminal division of the Tunisian Court of Appeal on Wednesday decided on his provisional expulsion at the request of the Libyan authorities".
He said that the case of Glib, who had been arrested in May upon his arrival in Tunisia, was in the "hands of the judiciary".
Last month, militiamen allegedly linked to Glib seized 245 Tunisians in Tripoli to put pressure on Tunis for his release, but they were later freed unharmed.