Q:

Java Eclipse "process" not ending after closing application

I am writing an application that displays webcam connected to my computer.
I will just write code here since the code is very simple.
public static void main(String[] args) {
    JFrameImageDisplayer _window = new JFrameImageDisplayer();
    //webcamGrabber _wg = new webcamGrabber(); 
    //commented out because I am having trouble with this class.
}

JFrameImageDisplayer opens a frame, pretty much that's all it does.
When I run this code, I open a simple application with a JLabel in the frame. If I close the application, then the whole process terminates( and the process at the Windows Task Manager Process tab processes as well).
However once I create _wg, the process at the Task Manager does not terminate even after I close the application ending up just burning processing power until I manually go to process bar to end it.
Below is the construction code for the webcamGrabber.
{
    OpenCVFrameGrabber _grab = new OpenCVFrameGrabber(0);
    try{
        _grab.start();

    } catch (Exception e){
        e.printStackTrace();
    }
}

A:

Well I was not so sure what do. So I manually released the resources.
protected void processWindowEvent(WindowEvent e){
    if(e.getID() == WindowEvent.WINDOW_CLOSING) {
        try{_wg._grab.release();}
        catch(Exception ee){}
    }
    super.processWindowEvent(e);
}

Not the prettiest way to do it, but it works. 

