Closed and Open Conformal Field Theories and Their Anomalies