Call endEditing before form view disappears to avoid an obscure crash on iOS 6