file ptr2.

what happens when we don't close a file pointer ?

I assume you mean that you exit without closing an open file. If so, from the man page of exit(2):

 All file descriptors open in the calling process are closed.

Check the man page of exit for more on what happens when you exit a process.

if you don't close all file pointer and exit then all file pointer will be closed after the process exit.

if file handlers are not closed,

kernel implicitly would close (fclose(fp)) all the descriptors and handlers ( including the file handler ) opened for the program (FILE *fopen)

but this closing of handlers are guaranteed only for safe execution of a program returning safely from the invoked routine --main.