I am not 100% glad with this solution. The version was found, so the 404 request is wrong. If you try to delete the active version, you get the 404 page and have to use the "back"-button, to go back to the motion.

I would like an error-message on the motion page. It could be done, like it is done in the participant app:
https://github.com/OpenSlides/OpenSlides/blob/master/openslides/participant/views.py#L150

If you don't want do to it, I merge your solution, but I would like a unique solution in OpenSlides.