```OSError "[Errno 9] Bad file descriptor"``` occurs here