We use the past continuous for an action that was suddenly interrupted by another one. For example: I was doing my homework when the telephone rang. Signal words: when, while
The past continuous also describes a past habit of someone or something that happened again and again: "He was always leaving the door open".