Man shot and killed by New York state police after he opened fire on their barracks