used write() and close()