The first and second sentences are correct. The third is not correct because it does not answer the question of "who" left. In order for the sentence to be grammatically correct, someone has to do the action. The following sentence is correct because it does tell who left.
The thief forgot to close the door before he left.
Instead of saying "The thief forgot to close the door before the thief left", the pronoun "he" is used to replace the noun "thief" in order to avoid repetition.
I hope this helps. If you need me to explain if further, please let me know. I would be happy to help you.
Student or Learner