Implement removeOnClose option