Fix topic type retrieval for multiple bag files

Fix a bug where get_datatype would return None if the last bag didn't contain the topic in question.

This was causing bag plugins for specific datatypes to fail to enumerate properly in the `View (By Topic)` context menu.