Some cleaning
Closing files properly

Added file closing code. Also updated file handler to include some new
ways to append files with :raw