Warning in front of the Scanner class line (scn.close() needed why?

why this shows the warning in front of the
scanner scn = new Scanner(System.in);
the compiler tells you that you need to close the scanner. I need to ask why should we do that.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.