Fixed exit process to allow app exit gracefully killing all threads