Added logic of close form