Added thread to check if the tunnel is still open. As soon as the tunnel has been closed, the shutdown counter is triggered.