Fixed FileExistsError usage in tests.