If you haven't had an attorney review your contract, the time to get one is NOW!
Whether or not you can terminate would really depend on the specifics written into your contract. In most cases there is a time frame attached to the inspection period. If this is in your contract and you are within your time period you should be able to terminate for any mechanical, structural or engineer deficiencies found within the scope of your inspection and receive your deposit back.
There are specifics to every contract/situation. You would really need to consult with your agent and/or attorney. So sorry there isn't a better answer. If I can help in any other way please feel free to reach out to me.