You are welcome to Port out of Optus at any time, you just need to arrange for your new provider to move the number over, you dont need to contact Optus. After the port has been completed Usually between 20 Minutes to 48 Hours, Optus will automatically finalise your account, if you are under contract the early termination fee/handset fee will be generated on your Account. If you are out of contract apart from the small $8 port out fee which both Telstra & Optus charge, you are free to leave.
Is there a reason why you are leaving, are you having issues with something? Have you considered speaking with Customer Retention to see if they can help resolve your issue? You can give them a call on 1300555241 to discuss resolutions to issues/billing/rate plans etc.