QHiMDMainWindow::~QHiMDMainWindow()
{
    if(current_device && current_device->isOpen())
        current_device->close();

    save_window_settings();
    delete ui;
}
void toolkit_quit()
{
    save_window_settings();

    if (window)
    {
        gtk_widget_destroy(window);
        gtk_main_quit();
    }

    window = nullptr;
}