Fix extension extraction from file name and add it as property

Adds an extension property to the (file) record. Also, fixes then file
extension extraction which in some cases was wrong