Database now disconnects on closing app