Arduino GIGA eject USB

Hi,
how should be done properly USB ejection?
If I simply remove it mechanically Mbed OS is crashed - red LED blink.
Any command what should I execute for safe eject?
I did not found any disconnect() functions.
Regards

Hi @viayner I would unmount the filesystem before mechanical pull. May still crash if the code isn't robust.