MULE-6831: Applications deleted when deployment fails

Creating anchor file on the application installation phase instead of during the start phase
(cherry picked from commit dcdbdd9)
(cherry picked from commit c5cda56)
(cherry picked from commit f043ecf)
MULE-6831: Applications deleted when deployment fails

Adding missing test file
(cherry picked from commit 52b2b73)
(cherry picked from commit 8c50363)
(cherry picked from commit a4f9829)