Add compressing secondary files

The utils.smart_extension function is used to add new extensions to
a filename, but to do it smart when concerning compressed filenames.

For example, when a LdaModel is saved and also needs to save the state,
use smart_extension to re-order the extensions so that the state is also
saved as a compressed file if the model is being saved as compressed.