For cleaning a recording head, a printer seals nozzles by means of a cap member and thus forms a closed circulatory system. In this state, a gear pump is activated and draws waste ink and the air from the cap member. The waste ink and the air then flow in the cap member, a check valve, a tube, the gear pump, and a different tube in this order and are introduced into a first ink cartridge. The air is introduced into a second ink cartridge through a corresponding tube as pressurized air. The check valve prevents the waste ink and the pressurized air from returning to the cap member. This suppresses backflow of the liquid and the air, and ink ejection is performed effectively.