Yes, you can exit your oil futures contracts before expiry. The profits or losses that you may have realized will be adjusted by your broker from your deposited margin.