now database connection is correctly closed after closing library