fixed bug where app wasn't closing properly.