Using 'with' to open file

Using 'with' keyword for opening file so file is closed at completion.