Implement confirmation before close window.
Simplify config retrieving.