Got max v working properly and now the program closes properly.