Added file and directory checking to train.py