Found a hack to make button exit functional. Hope there won't be any memory leak... :/