python 2.6 compatibility: Use 'with' statement only with one context

python 2.6 does not allow specifying multiple contexts in one 'with'
statement. And it is used by RHEL6.5
Fix it by specifying just one context per 'with' statement.

Signed-off-by: Aline Manera <alinefm@linux.vnet.ibm.com>