Fixed minor bug with print callback in shutdown_hook.