Added \endinput statement after each chapter to allow text like notes to be ignored but to be available near the related chapter