Fix crash on unmatched #endif's.

The following snippet would crash:
  #endif
  #if A