Just curious - this is usually the opposite of what you would typically want. Some customers like to browse/shop over time (for instance, while at work or on a lunch break) but then checkout later on. There are actually several apps out there to help ensure a customer's cart can follow them over time and across devices/browsers without emptying out.
Is there a certain reason you want to automatically empty customer carts? If one customer has a product in their cart, it does not prevent the inventory from being purchased by other customers.