Fixed error when checking out an empty cart

Moved $stmt->close() inside the loop over the shopping cart. It was
calling close() on a non-existent $stmt if the loop was never entered.