Search for Transient Gravitational-wave Signals Associated with Magnetar Bursts during Advanced LIGO's Second Observing Run