Automatically add correct file extensions

If no file extension is specified (or the wrong one), append
correct file extension. However, if the correct file extension
is set, do nothing to it.