Set pendingPlayerAttachDetach=false before ret

If there's an error, set the pendingPlayerAttachDetach value to false before returning.