Fix newline after first prompt; add close() on files when done.