implemented an extension of mkstemp to close the file after creating

Closed username-removed-919432 requested to merge dhishan1/coala-utils:master into master