Adds the logfile

"With" makes sure that we close the file should an error arise. But if an error arises, (error I am not handling), this stops the script. which closes the file anyway. 

I don't really see the reasoning behind the with, could you shed some light on it ?