Fixed writing files (mode 'r+b'). Handle exceptions with get_new_request.