I'd say make the code open source, you don't earn however it'll give you great rep for when you come out with your next software for the next siteJust thinking long term here....
Do not try to make him think otherwise. Buddy just close shop and take this one as a loss, shit happens that's business, just get back up and move on. Even if you were to make 20,000 I wouldn't risk it. You seem like a good coder at a guess. Think of something new or even sell your skills as a service.