fix darwin crash
add closefig function