callback: release GIL on error

If there is an error in the section where the GIL is held, it must be
released, or Python will stall.