Beware when moving ToC to back

I made up a blank page and added <$toc>, called it Contents and moved it to the back of the documents in the manuscript. I forgot to do something it the process and although the page was at the back, there were no contents. I made the change and recompiled, then suddenly I got a notice saying “Kindle failed to generate a .mobi file at the expected location.”

Given I had been successfully compiling for hours adjusting this, that and the other, I thought my KindleGen had become corrupted. I download a new file and ditched the old one. But the same problem occurred. It took a lot of trial and error to realize (duh) it was the ToC page causing the problem. When I moved it to Research, compiling returned to normal.

Any advice on WHERE to position ToC at the back and its indentation regards the Manuscript? I’ve tried various locations without success.
Additional info: I use a page break before the ToC page and As is, as was pointed out by someone who successfully moved his ToC to the back (read on the Internet).