After taking over Heaven, the Scribe of God Metatron appropriates the library to act as one of his safe houses. Feeling that "nobody goes to libraries anymore", Metatron has another angel hide Castiel's grace and the demon tablet within. He has the angel hide riddles to where they are hidden in some of Metatron's favorite books but not give Metatron the exact locations so that they can't be tortured out of him.
After leading Castiel to three of his safe houses with nothing in them, Metatron eventually leads Castiel to the library where Castiel can sense his grace but it is hidden from him. Metatron explains his precautions to Castiel and leads him to a book with a piece of paper containing the quote "what's the maddest thing a man can do?" Metatron pretends that he doesn't understand what it means and leads Castiel through the library in search of a book that supposedly has that title.
Metatron eventually casts a spell that stuns Castiel, allowing Metatron to get the clue leading him to the demon tablet. Seeing this, Castiel realizes that the clues are quotes and locates his grace in a copy of Don Quixote. Castiel reabsorbs his grace and becomes a Seraphim again, but in doing so he sends out a shockwave that destroys the nearest bookshelves.
Months later, the Winchesters and Castiel discuss how Metatron escaped from Castiel at the library by stealing Castiel's Pimpmobile. To their surprise, there have been no signs of any suspicious accidents with the car since then.