You can close a window using the DestroyWindow API Function.