Do you have a screen protector or a case whose lip hangs over the top front of the phone? Anything that obscures the proximity sensor (which is typically right next to the earpiece) can interfere, making the phone think it's still up against your ear. Make sure the screen isn't dirty over the sensor, and make sure you don't have a case that might be blocking it.