Cosby loses bid to get criminal case dismissed