Retry writing the library three times