Use with statement

Use with statement when working with files whenever possible.
Use os.makedirs() to create Glances target directory and all parent
ones as needed.