Waveform-Aware Optimal Window Function Design for Mismatched Filtering