After splitting a data into their train and validation lists, I want to append each list to their respective files. Even though the files are open, I am getting an I/O Oper