Updates database on logout