[fix] do not access database if server is closed