terminate sender thread in a graceful manner