Fixed issues when the program finished executing.