Fixed pretraining file opening bugs