added error check and corrected export of writeTopicDependencies