App works except for graceful exit