It is not seen as good practice to stop your application from being closed.
See an example of why here
Even if you hide the close button and intercept the alt + f4 keypresses, and handle the exit code of the main form, the user can still force the application to close via task manager.