It's all in your contract. If you know your timelines and understand the options, you may find a way out if you really want out. Let me just say before you find your exit, make sure you're not suffering with Buyer's remorse. Any major decision like this comes with some second thoughts, but unless something major has changed, you like the house, agreed to the price and terms and are on your way to closing.
If after reconsidering your change of heart you still want out (and do this quickly) ask your agent for your options.