extract framework.close() to __main__ for console env