An even more common scenario that would trigger the bug is if I pass an invalid directory. The `open` call will fail since the directory does not exist, and the loop will never end.