Way to close FileChooser when destructor is run on my AudioProcessorEditor or make it modal

Hi! I am really new to JUCE and i have to say that this is the best cross-platform framework that i have used.....

I am currently debuging my juce plugin on DAWs and i found a bug in my code that i can't figure out how to fix!

 

So... i have VST plugin that uses native open/save file dialogs(FileChooser class) for loading FIR filter parameters and other stuff.... it works quite well till the moment when the user presses open file button then closes plugins UI in DAW and then selects some kind of FIR parameter file.....

Everything including the DAW crashes with "Access violation exception", beacose my MainWindow(AudioProcessorEditor) has been deleted from memmory...

 

Is there a way that i can make that native open/save dialog modal.... or atleast close it when destructor is run on my MainWindow class?