RAII for file dialogs