Adds the logfile

And the python documentation for python 2 says : 
Note Not all “file-like” types in Python support use as a context manager for the with statement. If your code is intended to work with any file-like object, you can use the function contextlib.closing() instead of using the object directly.

https://docs.python.org/2/library/stdtypes.html#bltin-file-objects

If the python documentation tells me to be careful with the "with" statement while working on file objects, they may have a point...