We use the perfect progressive aspect to talk about an action that was once ongoing, but has since completed, like "I had been waiting for twenty minutes."
License: CC BY-NC-SA by Khan Academy