when the remove part is getting executed, i got a "file already in use error". is there any way i can add some sort of check that the file is fully closed or forcefully delete it? I also tried it with pathlib.unlink and with subprocess but not work either!
if os.path.exists(os.path.join(path_files_folder, file)):
os.remove(os.path.join(path_files_folder, file))