2つのmodalを同時に閉じたいとき、
[self.presentingViewController.presentingViewController dismissViewControllerAnimated:YES completion:NULL];
するとできました。一番深い階層のmodalを指定すると、その前のものは全て閉じることができるみたいです。
(http://stackoverflow.com/questions/8798491/dismissing-multiple-view-controllers-in-ios-5)
UIViewControllerのドキュメントにも書いてあります。
If you present several view controllers in succession, thus building a stack of presented view controllers, calling this method on a view controller lower in the stack dismisses its immediate child view controller and all view controllers above that child on the stack. When this happens, only the top-most view is dismissed in an animated fashion; any intermediate view controllers are simply removed from the stack. The top-most view is dismissed using its modal transition style, which may differ from the styles used by other view controllers lower in the stack.