Change file() to open() continued

Update file calls to open calls due to file's deprecation,
and also use with statements to take care of closing files.

Change-Id: Iab7c37fdc18cafa9dfcbd2e9a8fe4f82022dcca0
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1128715
Signed-off-by: Yeela Kaplan <ykaplan@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/33859
Reviewed-by: Dima Kuznetsov <dkuznets@redhat.com>
Reviewed-by: Dan Kenigsberg <danken@redhat.com>