Closing and receiving file

Needs finishing: save downloaded file