We visited Puglia for two weeks this past late November/early December. I can understand you staying in both Monopoli, for a city, and at a masseria for that setting.
We went to Matera as a day trip while staying in Altamura. Maybe late November is way out of its tourist season, but the place was almost dead, with very few options open for available food. We were able to visit three churches set into the rock, and a former cave-home museum, but unless you were interested in crossing the “Tibetan Bridge” across the gorge and exploring the archaeological park to the east of town (which I would’ve done, with more time), one day was adequate. September probably has more happening, but as Roberto suggested, I’d still think that 2 nights would be plenty.
If you get a chance to visit Martina Franca, maybe on your way to or from Lecce, we stayed there several nights, and both the walled old town and the new town were wonderful. We needed to turn in our rental car at the Bari airport on Saturday, and then spent our last night in Puglia in Bari.
As for staying in Bari your last night, absolutely, do that! That’s what we did, partly because we’d scheduled to turn in our car earlier that day, and partly for a night in a bigger city, as everyplace else had been very small towns or smallish cities. Even Lecce is less than 100,000 people, and we had lunch at a masseria nearby one day, but Bari is big and cosmopolitan, and we were there on a holiday festival night. We had been staying inland in Puglia, so this gave a night where we could do a seaside stroll, after wandering towards the port. We stayed at the Hotel Bari 102, really a posh B&B run by delightful Agata and her family. After turning in our car at the airport, we caught the Tempesta shuttle bus into the Centrale train station downtown, and it was a fairly short walk to the B&B. You could do that in reverse to get to the airport the next day. Outstanding dinner at Il Pane e Le Rose, 2 1/2 blocks from the B&B.