Map opened using plugin saves as tmx format

On a Mac, opening a file using a plugin was not setting the  mapDocument's writerPluginFileName. This means that it would default to the tmx format.

Changed the dynamic_cast call to qobject_cast.