Corrected termnation of loader thread.
 Clean up.