added progress dialog. fix window leak