create temporary database on same filesystem and use atomic rename