Fix issue where program doesn't terminate after the main window closes
Use pack() before setLocationRelativeTo()

This change is made in hope that it has effect to the window being not
displayed at the center in Mac (not tested).