Temporal Shaping of X-ray Pulses via Saturable Absorption