This equation can be made exact by finding an integrating factor

Let be a differentable function of x

multiplying the equation by phi we get

Remember to be exact that if we have an eqaution of the form

it is exact if

Now solving for phi we get

So using this we get

This is now exact and can be solve using that method.

I hope this helps.