A Denver police officer accidentally fired his gun while trying to turn on a flashlight mounted on his weapon in March, the department’s third flashlight-related discharge in two years, records show.