Question: I'm making a desktop app in Java Swing using the Netbeans platform. I want to convert a 16 bit gray scale image to an RGB image. How can I do that?

Answer: 
CloseHandle() does not destroy, terminate or supspend the thread, it only destroys the handle itself (so then you don't have a handle to kill the thread or wait on it). The thread continues to work normally (I have utilised this in numerous cases), and the only way to stop it is either exit the thread function (ThreadProc()), or kill it.
Best thing is to read the docs carefully. Win32 API is well documented.

from [MSDN on CreateThread in the Remarks section](http://msdn.microsoft.com/en-us/library/ms885186.aspx) it says

> 
> Thread execution begins at the function specified by the lpStartAddr
>  parameter. If this function returns, the DWORD return value is used to
>  terminate the thread in an implicit call to the ExitThread function.
>  Use the GetExitCodeThread function to get the thread's return value.
> 
> 
> 

Following on from that, you should let the thread entry function do its job and finish. I.e. exit the loop which would return the thread entry function.