Stabilization of liquid sloshing by foams