Justices uphold state gun control law