You can put these in a single `with` statement. See http://docs.python.org/2/reference/compound_stmts.html#with.