Add proper file saving on close.

On open, the java file is expected to only contain the user's content.
However, during editing of the file it should be runnable so it should be proper java code.

Therefore, the proper java code is usually saved to the file.
However, when the editor is closed,
the user's last saved content will overwrite the java file.

This way upon open, the user's content is present in the file.