If you wish to entirely erase the QSPI flash of the discovery kit, (e.g: for repurposing it), while the software is not in USB storage mode, press the user button twice. It will proceed to unmount the file system created on the flash, and then proceed with the erasing procedure. This usually takes a few minutes, so please be patient.
Once it is done, the system will deinitialize the block device and halt. You can then flash another program on the internal flash of the discovery kit.
Here are a few things to keep in mind: