When I was praying mustahab namaz today, there was someone at the door continuously knocking on it. I left the namaz midway to open the door. Is my namaz valid or do I have to repeat it all over again?

It is a mustahab prayer so it does not matter either way. But if you are concerned, then you can repeat it