Clean up perforce connection to use a context manager.
Review Request #6707 — Created Dec. 19, 2014 and submitted
This change makes a long-awaited cleanup to the perforce connection logic,
using a context manager rather than an ugly except block. I've also moved the
import of P4Exception to hopefully work better across a range of systems.
Ran unit tests.