Only trigger onClose when it's set