Hi Barbara,
the render() function returns a pixel map of the png image. This is what you see in file2 (just ignore it).
The PNG file will be written into a file, whose name corresponds to the one you provided to the render method. For instance:
my_img_map = tree.render("myFileName.png")
cheers,
Jaime