Thread terminating gracefully

Add terminating for separate thread then application is quit