Should be done in a finally so it always gets closed.