fixed bug wheras thread does not end, if interrupted. Only was printing
stacktrace