Fix various issues related to minimizing the main window

Relates to #98