database: Copy the file pointer so we can keep the file open