Automatic Qubit Characterization and Gate Optimization with QubiC