Fixed issue with closing program