Force to call Form.close() before window.close(), because onunload won't be called on window.close().