Optimization of Resonant $\Lambda$-type Quantum Memory with Gaussian Pulses