Add check on file close
Working aiolib write