Is it ok to trim a header to make a door fit?
I am assuming that the main support beam was properly supported on either side of the staircase before you began this project.  If not, you have a bigger problem that may need an engineer, or at least a serious framing contractor. If is is properly supported, read on.

A simple closet door by itself in a partition wall (non-loadbearing) does not need a true structural header. Headers are used to carry and transfer weight where a door interrupts a load bearing structure.

If there was no header in the wall before and it was sound, the only weight being carried is the small amount of framing over the door and the surface covering, such as a small area of drywall. The top plates should be enough to carry this weight. 

If you added a 2x10 inch header, you have given it more support than it really needs and trimming 3 inches off that header should be no problem.