Vim editor is nothing but improved edition of Vi editor and all functions of Vi will also work in Vim.
In your case, you can close the file with following colon mode commands:
:w - Save
:wq - Save and quit
:wq! - Save and quit forcefully.
But as far as I could understand, in your case, it might be a problem of super-user privilages. I think you're opening the file directly as:
Ubuntu don't by default gives you the root or super-user privilages, but you need to use sudo to access that. So just try to open the file with sudo command, as:
sudo vim <filename>
Enter your password:
It will give you super user privilage to modify the file.
Let me know if it helps you!
Last edited by shivaa; 10-12-2012 at 01:46 PM.