masks: on deletion of brush nodes: remove complete shape if only one node is left

(cherry picked from commit dc27f81bbcd0e013100594a1022283078a7de7cf)