gprot.py: Use context manager when writing ITP file