What you need to do is heave-to, drop the main, and return to running downwind.
While running, watch for a wave to break to windward. Turn up into the wind where the wave broke. Set the helm hard a lee, sheet in the main, but leave the storm
jib sheeted. With the
jib back winded and the helm hard over (hove-to), drop the main. Then, while looking out for breaking waves that could hit you abeam, ease the helm and continue sailing.