added None check and closed check for close file method