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)
MULE-6831: Applications deleted when deployment fails

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