Fixed ptexViewer to register for windowClose