Self-consistent removal of sawtooth oscillations from transient plasma data by generalized singular value decomposition