Fixing potential bug where we are not releasig correctly the hproc upon
task detach and connection failure