Check to see if modals exist before appending

This caused images to not render because they were looking for the
captionTrackModal when it did not exist because addRelatedDocs.js
initializes a ractive element for it.