The Veil

A veiled figure was a clockwork construct within the castle inside the Twelfth Doctor's confession dial. It took the form of an old woman who died when he was young; she was covered in white veils, but it was a hot summer day and her body attracted flies, which gave the Doctor nightmares for years.

The figure pursued the Doctor at exactly the same, slow pace, never relenting. Monitors located throughout the castle showed its viewpoint, letting the Doctor know where it was at any given time. The Doctor deduced that it was designed to force him to confess his deepest secrets. Whenever he did so, it would freeze and the castle would reconfigure itself, bringing him closer to Room 12 and the way out.

Within Room 12, the Doctor found a wall of solid azbantium, 400 times harder than diamond, marked with the word ‘Home’. He realised the ultimate secret his captors wished him to confess: the true identity of the Hybrid prophesied to conquer Gallifrey. Unwilling to give up such dangerous knowledge, the Doctor began to punch the wall, allowing the veiled figure to catch up and fatally injure him.

In the day and a half it would take him to die, the Doctor hauled himself back into the teleport room and wired himself into the controls, burning up his current body to bring an identical copy of himself into the castle. He left himself a single clue, the word 'Bird' written in the sand, to remind himself of a story about the meaning of infinity. This allowed each version of the Doctor to realise what he needed to do. Bit by bit over two billion years, the Doctor struck the wall until it finally shattered. When it did, the figure collapsed into clockwork parts.

Entering the portal behind the wall, the Doctor discovered himself on Gallifrey with the confession dial in his possession. (TV: Heaven Sent)