Adds the logfile

there is no much more reasoning than convenience and error handling: You don't need to remember to close the FD, the code looks better (all operations on a file are indented in the same block), is easy to [nest FDs](http://stackoverflow.com/questions/9282967/how-to-open-a-file-using-the-open-with-statement) (again, for convenience)..