use "with"-statement in Python 2.5 (#5852)