pdf: ensure that the toc list is properly terminated