Mainly added fixes in exports - deleting empty files, closing streams