WICKET-5776 Add information about the component when it fail in detach phase

try/catch the application related logic in Component#detach()

(cherry picked from commit 39b65ecf1ce4a3904227a9dbdec9f8ca874f8a7e)