The fact that the software is open source doesn't change anything about the contract that the developer has with their client. If the developer has done the work, the client owes the money.
Contracts to deliver custom software (or many other services) often specify several stages of payments and delivery, and allow one party to suspend the contract if the other party has not fulfilled their obligations. For example, if the client misses a downpayment, the contract typically allows the programmer to suspend deliveries of the software. This works regardless of the license of the software.
Where having open source code may make a difference is that if the client doesn't pay, the developer loses the possibility of suing them for copyright violation in addition to breach of contract. If the client is using open source code, that's legal, regardless of any other contract they might be in breach of. On the other hand, if the contract is the only reason why the client has the right to use the code, then a broken contract may allow the developer to claim damages for copyright violation. (Consult your lawyer if it gets that far.)
Note that a contract to write code that will be open source does not imply that the code will be on Github. Most free/open-source licenses do not carry the obligation to distribute modified version; they only require, if they're copyleft, that any distribution includes source and that further distribution remains allowed. There are works with a license that require contributing modified versions back upstream if they're distributed at all, but they're rare. Unless the contract specifies that delivery is via Github (probably a bad idea as it puts a third party into the loop), the developer has the same means of blocking delivery as with closed-source code. Of course, the developer may want to distribute the code publicly for other reasons.
Inasmuch as the license permits, it would be a good idea to treat the code written as part of the project as proprietary until payment in full, at which point the code becomes open source. However a copyleft license may make it impossible, depending on the structure of the project.
A final note:
When you are finished you go to the customer and tell them you are finished. They tell you that they don't like your work and they won't pay you for your service. Due to your contract this is allowed.
If the contract allows the customer to decline to pay because they “don't like” the work, there's something seriously wrong with the contract, regardless of the license of the code. A party shouldn't be allowed to cancel the contract at will. There should be objective acceptance criteria that make it mandatory for the client to pay, even if they've stopped caring about the work. The most common type of acceptance criteria for software are functional: the software shall have this and that feature.