A gunman opens fire outside a mosque in northwestern France, wounding the local imam and another person, before fleeing the scene and later being found dead, officials say.