By this do you mean locked? Or actually sealed?When and why was the Tower of Orthanc sealed ?
No offense to the questioner KellGreenleaf, but this question is too broad and unknown to answer with any surety. Indeed the controversy surrounding Ungoliant is nearly as great as the Winged Balrog debate or whether or not the Sons of Elrond went over the Sea at the end of the Third Age. Starflower's answer was very good, and seems the most likely, but no text ever says specifically that Ungoliant was a Maia. She was a "corrupted spirit" or something. Anyway, must letting you know! Sorry to be pedantic!Who or what was Ungoliant?