Added code that write model file when averaging k models