Pakistan's top court upholds ruling for military courts