Regarding copyright :
If you are a company or independent writer then all code you have written and supplied is your copyright. No
other third party has any right to any aspect of it. If you give them the source do not be surprised if they sell
it. Or maybe abandon you and modify your software themselves. They have committed an offence by taking
your work and claiming it is theirs. You need to secure your software to prevent a company, or one of their
employee from selling on your software. Usually with some physical secure file or user number to which only
you have access and the ability to set.
If you issue your complete code for an application, it will include your own libraries, functions and procedures
that you have probably built over many years. That work the client cannot claim a right to and has not paid for.
However, to pass on all that work would appear to be ill advised to say the least. It may be actually one the the
main assets of your business. If you must or are obliged to issue your application code, exclude your libraries etc.
If a client pays you to write a package solely for them, the code is still your copyright. Unless you agree otherwise.
If you have a coder writing for you, who you instruct and employ, their work is actually your copyright.
Similarly, if you are an employee of a company, all of your work is that company's copyright.
There is no major difference in copyright ownership between a writer of books, songs or software.
In a similar vein. Do not sell the package to anyone. Only sell a license to use it, as Microsoft and all other major
companies do the same. If you sell it, it is possible that they can sell it on, depending upon your T&Cs. If you sell
only a license to use, they cannot do that. If they go into liquidation, having purchased a license to sell from you,
any company buying the assets cannot use your software. You then sell a new user license to them.
It's your time and expertise, protect it.