Even if rates are rising, your rate will not go up if you close before the lock expires.

When you lock your interest rate, the lender guarantees that the rate will not change if your loan closes by the lock date. The lender is assuring you that your rate will not go up if you close before the lock expires, even if rates have risen. You are also agreeing to that rate even if interest rates drop. You are trading no pain for no gain. However, as outlined below, most lenders have a policy that will let you take advantage of a very sharp rate drop after you have locked in.
It is impossible to know what interest rates are going to do in any 15 to 60 day period. Interest rates are inherently volatile, and they can move sharply on unexpected economic news or world events. The release of the monthly unemployment number or the monthly consumer price index can have a dramatic effect; so can the tone of a Federal Reserve Board governor’s after-dinner speech in Oklahoma City. Because of this uncertainty, most lenders will want you to lock in your rate upon receiving your application.
If you wait to lock in, expecting to get a better rate, your chances are better if the current rate trend is down. When rates have been rising over the past three to six months, hoping for a tick down in the next few weeks is a gamble. Even if rates have been steadily declining, in any given month they can still move higher. In fact, even hugely successful bond traders bet right on short-term interest rate moves only 55% to 60% of the time. It is unlikely that a mortgage broker, a banker, or you will do better. If you are satisfied with the rate and terms you have been offered, locking in the rate when you apply is a prudent move. You may want to read What are interest rates going to do in the future?
Most lenders have a float-down policy. This policy defines the circumstances under which a lender will lower the rate on your loan if rates have dropped after you have locked and before your loan documents have been sent to escrow for signing. This policy varies from lender to lender—you should ask about it when you lock in your rate. For lenders who have a float-down policy, the rates have to drop substantially before they will drop your rate. As a rule, if rates have dropped one-quarter of a point, your rate will float down by one-eighth of a point. If rates have dropped, you have time, you are working with a mortgage broker, and you aren’t happy with the float-down policy, the broker may be able to submit your loan to a different lender.
It is almost impossible to hit the bottom in rates when buying or refinancing. If you have chosen a loan that has no points and no prepayment penalty—something I recommend—you can always refinance down the road if rates continue to drop. Remember, by locking your loan, the lender is providing an important service. Lenders are at risk when you have locked a rate—lenders hedge their exposure and lose money when borrowers who lock an interest rate fail to close.