check bamclient is null before shut down