change from Peter Cummuskey to fix weird close issue