fixing persist function...again. forgot to close file