Ask your investors.
If it’s truly hopeless and you’ve given up, and there is money left … most / all investors will want their money back.
But if there’s still some chance, and/or you have a great team that wants to “pivot” and try something new … some investors will prefer you do that.
If the investment is a small amount for your VCs/angels/etc. as a % of their net worth / assets, they may just prefer to roll the dice again if there’s some chance the 2.0 version of your start-up could work.
After all, the downside is limited, and the upside in limitless 🙂
But if it’s a large investment for anyone, especially individuals … they may want whatever money they can get back … back.