I am browsing the files in vim file explorer by entering vim dirname.
Then I am opening the file, saving and closing it by entering :wq.
Now the file explorer window disappears.
How to prevent this behavior?
The :quit command (also as part of :wq) quits Vim if this is the last window. As you use :Explore, the opened file replaces the netrw explorer, and exiting Vim is the result.
If you want to keep the file explorer, you can open it in a split window, with :Vex (vertical split) or :Sex (horizontal split). That way, when you close the file, another window is still open and Vim won't quit.
Also, inside a netrw explorer, if you open the file with o / v instead of <Enter>, the explorer will be kept and the file opened in a split; cp. :help netrw-browse-maps. You could also reconfigure the default behavior on <Enter> via :help g:netrw_browse_split.
-). I mapped the minus symbol to :Explore in normal mode and it feels very natural to me. It's a personal preference but maybe you can use it as well:map - :Explore<CR>