Which leg of hedged trade should one square off to avoid margin error?

In case of a hedged position, it is recommended to always close the leg with sell positions first and then close the leg with buy positions. This is because the sell positions of a hedged trade have higher margin requirements while buy positions of the same trade require only the premium amount.