Contact form 7 Lets you call a JavaScript function after the form has been submitted
You will find the Additional Settings field at the bottom of the contact form management page and you need to use the hook named on_sent_ok
something like this:
on_sent_ok: "$.fancybox.close();"