Program closing issue solved