Fix corruption of .aux .toc files

Any auxiliary files containing calls to \contentsline may refer to
macros only defined by chklref.sty, thus forcing the user to delete any
temporary files. This is fixed by populating any auxiliary files with the
definition of \chk@immediate@write.
Use the upper-case prefix CHK@
Add a test file containing \tableofcontents