fixed bug in final new line for closed files
cleanup
Merge origin/master