Ironically, the last Pope to resign voluntarily, Celestine V, was the last to be selected by cardinals not locked into a room, that is, by a papal conclave instead of a papal election. In 1294 the hermit Peter Morrone wrote a letter to the cardinals, who had been stalemated for two years, ranting of God's dire judgment if they did not select a new Pope, soon. In a scene reminiscent of Dan Brown's Angels and Demons, the papal electors took this as a sign from God and elected the shocked hermit Pope.
Conclave means, literally, "with key". The original locking of the cardinals behind closed doors was not to assure secrecy. They were going to talk as soon as they were released, and everyone knew it. The intent was to force them to resolve their differences and choose a Pope before hell freezes over. The cardinals are, after all, management, and like all managers, they would put off making a decision until the last trump, if allowed. This led to long interregnums, periods without a definitive leader of the organization. Since in the Middle Ages the Pope was much more important in the everyday affairs of the common folk, those unfortunates took to making life as difficult as possible for the cardinal electors until they chose. They locked them in a room. They bricked up the building. They increasingly restricted their rations. When none of that worked, they removed the roof to expose the cardinals to the hot sun and cold rain. That finally did the trick.
The conclave was codified. When the rules were abated a few years later, the cardinals resumed their procrastinating ways. The hardships were restored. No conclave since the Papal Conclave of 1830-1831, which lasted seven weeks, has taken a week. Before that, no conclave had taken less than three weeks.
One wonders what the ascetic hermit Celestine V, condemned to wander forever just outside the gates of hell in Dante's Inferno, must think about men so worldly, so sybaritic they are tormented into action by such a brief time locked in a chapel surrounded by the world's most magnificent artwork.