Fixed issue of corrupted files by closing and reopening file. Debugged saving and cleaned up files.