I'm not sure but I think "frame.dispose();" would work.