Simplify disposal of some resources
Fix wrong handle lifecycle

git_branch_delete() only frees the handle upon success.