Bug 7486 - exit handler not executed on syntax errors

Summary: exit handler not executed on syntax errors