replaceRequireJsWithAlmond: Fixed some bugs and added tests.

* Make sure that the almond.js relation is inserted at the right index so that bundleRelations doesn't put it after the code that needs it
* Remove orphaned require.js/almond.js assets in scenarios where there's more than one Html pointing at them
1.6.18