Serial.print hangs if terminal not open on M0

I’m working with an Adafruit feather M0 and am seeing a hang on Serial.print if the terminal gets closed. I’ve tried watching if(serial) to see the connection close but that does not work.

I do wait to see a serial connection with if(serial) after that code works fine. If I pull the USB connection, the if(serial) continues to return true. Any prints hang at this point.

I have also tried checking availableForWrite before the print but that fails to prevent the hang.

Is there a way, on the M0, to detect when the terminal connection has been closed so that the code will continue to operate?

Maybe I have something else going on but I’m fairly sure that the following is true.
Wait for serial connection with if(serial) [works]
use prints to send data [works]
use if(serial) to watch for loss of connection [fails, always return true after initial connection is done]
If after you have connected, you close the terminal, prints will hang.

Any advice?