diff --git a/plexpy/database.py b/plexpy/database.py index 4762805f..e70d6c77 100644 --- a/plexpy/database.py +++ b/plexpy/database.py @@ -490,4 +490,8 @@ class MonitorDatabase(object): # Get the last insert row id result = self.select_single(query="SELECT last_insert_rowid() AS last_id") if result: - return result.get('last_id', None) \ No newline at end of file + return result.get('last_id', None) + + def __del__(self): + # Close the database connection when object is garbage collected + self.connection.close()