Suppose I sold an option on stock X, with strike price Y, and expiry date Z. Suppose I later buy an option on the same stock, with the same strike price, and the same expiry date. Do these two positions cancel out each other (i.e. both contracts cease to exist anywhere), or will I end up with two separate contracts?
Is it the same with the reverse situation? e.g. I bought an option on stock A, with strike price B, and expiry date C. If I later sell an option on the same stock, with the same strike price and expiry date, will I end up with two contracts (one long position, one short position)?