Virginia judge upholds most of new gun background check law