In general, one must obey lawful orders from a police officer during a traffic stop, or indeed any encounter where the officer is engaged in official police business. An order to open the window, or indeed to get out of the car, is generally lawful.
If one suspects that the "officer" is actually an imposter, or that the officer is a real officer but may use unlawful violence, one is entitled to take some measures of protection. One can use a cell phone to call emergency services and report the incident, asking if the person making the stop is a legitimate officer. This is particularly desirable if the car is unmarked and the person is not in police uniform. One can ask to see a badge or other police ID. One can drive, slowly, to a nearby police station, or to a well-lighted, public place where others are likely to be about. The call to emergency services has the advantage that the call will be officially recorded, and if the person is not an officer, actual officers will probably respond quickly.
It is a good idea to communicate intentions to go to a station or public place so that an actual officer will not think the driver is trying to flee.
Having an in-car video recording setup may also be a good idea.
But once the driver has good reason to believe that the officer is legitimate, instructions to open the window or come out of the car should be obeyed. Failure to obey may itself be a crime, depending on the jurisdiction.