Stop motor ASAP after touching ground in mission mode

Is there any possibility to reduce time of spinning motors after landing drone in mission mode? Sometimes, when the level is not flat surface my drone trying to correcting position and flip upside-down destroying GPS holder and propellers. After flip the drone doesnt know about it and still spinning motors (which two of them are blocked).
The dream solution is to disarm drone or stop motors immediately after touching ground (which is easy to recognize in accelerometer).

Thanks!